以下是同花顺背离了指标公式
DIFF:EMA(CLOSE,12)-EMA(CLOSE,26);
DEA:EMA(DIFF,9);
MACD:2*(DIFF-DEA), COLORSTICK,LINETHICK2;
A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));
D1:=(EMA(C,3)-EMA(C,8))+0;
D2:=(EMA(O,3)-EMA(O,8))+0;
D3:=(EMA(H,3)-EMA(H,8))+0;
D4:=(EMA(L,3)-EMA(L,8))+0;
STICKLINE(D1>=D2,D1,D2,8,0),colorlired;
STICKLINE(D1<=D2,D1,D2,8,0),COLOR006600;
STICKLINE(D1>=D2,D1,D2,5,0),colorlired;
STICKLINE(D1>=D2,D1,D2,3,0),colorlired;
STICKLINE(D1>=D2,D3,D4,0,0),COLOR00BBFF;
STICKLINE(D1<=D2,D1,D2,5,0),COLOR009900;
STICKLINE(D1<=D2,D1,D2,3,0),COLOR00BB00;
STICKLINE(D1<=D2,D3,D4,0,0),COLOR00EE00;
底背离:=REF(CLOSE,A1+1)>CLOSE AND DIFF>REF(DIFF,A1+1) AND CROSS(DIFF,DEA);
STICKLINE(底背离,0,0.03,6,0),COLOR00FF00;
底背:DRAWLINE(A1=0,DEA,底背离,DEA,0),COLORFF00FF,LINETHICK4;
DRAWTEXT(底背离,DIFF,’ 底背离’),COLORFF00FF;
A2:=BARSLAST(REF(CROSS(DEA,DIFF),1));
顶背离:=REF(CLOSE,A2+1)<CLOSE AND REF(DIFF,A2+1)>DIFF AND CROSS(DEA,DIFF);
顶背:DRAWLINE(A2=0,DEA,顶背离,DEA,0),colorgreen,LINETHICK4;
DRAWTEXT(顶背离,DIFF,’ 顶背离’),COLORFF
评论(0)