TAG:副图 信号

网友求助:

源码如下,要求:在30分钟周期显示背离信号,在日线周期显示死叉关注信号。
RSV:=(C-LLV(L,9))/(HHV(H,9)-LLV(L,9))*100;
K:=SMA(RSV,3,1);D:=SMA(K,3,1);J:=3*K-2*D;
底背离:=C=LLV(C,13) AND J>REF(LLV(J,13),1);
DRAWTEXT(底背离,0,'㊣'),COLOR000050,ALIGN4,PXDN20;
顶背离:=C=HHV(C,13) AND J<REF(HHV(J,13),1) AND C>REF(C,1);
DRAWTEXT(顶背离,0,'※'),COLOR550000,ALIGN5,PXUP20;
DXMS:=CROSS(D,K);
死叉关注:DXMS,LINETHICK,COLORDD;)

 

解答如下:

RSV:=(C-LLV(L,9))/(HHV(H,9)-LLV(L,9))*100;
K:=SMA(RSV,3,1);D:=SMA(K,3,1);J:=3*K-2*D;
底背离:=C=LLV(C,13) AND J>REF(LLV(J,13),1);
顶背离:=C=HHV(C,13) AND J<REF(HHV(J,13),1) AND C>REF(C,1);
DXMS:=CROSS(D,K);

if datatype=4 then begin
DRAWTEXT(底背离,0,'㊣'),COLOR000050,ALIGN4,PXDN20;
DRAWTEXT(顶背离,0,'※'),COLOR550000,ALIGN5,PXUP20;
end else
if datatype=6 then begin
死叉关注:DXMS,COLORreD;
end;