macd里谁和谁的金死叉?diff 和dea的金叉死叉?
波动幅度是区间的k线的(最高价-最低价)/最高价?
VARIABLE:n1=0,n2=0;
DIFF :EMA(CLOSE,12) - EMA(CLOSE,26);
DEA :EMA(DIFF,9);
MACD :2*(DIFF-DEA);
jc:=cross(diff,dea);
sc:=cross(dea,diff);
DRAWICON(jc,l,1);
DRAWICON(sc,h,2);
if jc then begin
n1:=n1+1; //金叉后n1赋值为1
n2:=0;
h1:=h; //记录金叉当根k的最高价
l1:=l; //记录金叉当根k的最低价
end
if sc then n1:=0; //死叉后n1赋值为0
if n1=1 and h>h1 then h1:=h; //n1=1 是在金叉到死叉区间,当k线最高价比金叉当根的最高价高时记录
if n1=1 and l<l1 then l1:=l; //n1=1 是在金叉到死叉区间,当k线最低价比金叉当根的最低价低时记录
波幅:(h1-l1)/l1;