MACD背离副图公式源码
DIF:EMA(CLOSE,12)-EMA(CLOSE,26);
DEA:EMA(DIF,9);
MACD:(DIF-DEA)*2,COLORSTICK;
金叉:=CROSS(DIF,DEA);
金叉天数:= BARSLAST(金叉);
日前:=MACD<REF(MACD,1);
日后:=MACD>REF(MACD,1);
STICKLINE(日后,0,MACD,0.688,0),LINETHICK4, colorred;
STICKLINE(日前,0,MACD,0.688,0) ,LINETHICK4,colorgreen;
倍柱:=MACD>REF(MACD,2)*2 AND DIF>DEA ;
STICKLINE(倍柱,MACD/1.5,0,0.36,0), LINETHICK2,coloryellow;
上次金叉天数:=BARSLAST(REF(金叉,1)) ;
MACD底背:=DEA>=REF(DEA,上次金叉天数) AND 金叉 AND O<REF(C,上次金叉天数);
DRAWTEXT(MACD底背,DEA,' 底背离'), COLOR00FFFF;
金叉DEA值:=REF(DEA,金叉天数) ;
s金叉DEA值:=REF(DEA,上次金叉天数) ;
零轴下金叉:=金叉DEA值<s金叉DEA值 ;
A:=金叉 AND DEA<0 AND 零轴下金叉 ;
DRAWTEXT(A,DEA,'A') ,LINETHICK4,coloryellow;
T:=BARSLAST(A);
B:=金叉 AND 金叉DEA值>s金叉DEA值 AND s金叉DEA值<0 ;
DRAWTEXT(B,DEA,'B') ,LINETHICK4,coloryellow;
赞 (0)