%> 通达信一成MACD背离指标公式_
通达信一成MACD背离指标公式 2685

DIFF : EMA(CLOSE,12) - EMA(CLOSE,26);

DEA : EMA(DIFF,9);

MACD : 2*(DIFF-DEA), COLORSTICK;

JC := DEA-DIFF;

绿柱面积:=IF(MACD<0,SUM(MACD,BARSLAST(JC<0)),0);

红柱面积:=IF(MACD>0,SUM(MACD,BARSLAST(JC>0)),0);

本次最低价:=LLV(L,BARSLAST(JC<0));

本次最高价:=HHV(H,BARSLAST(JC>0));

X1:=IF (MACD<0,BARSLAST(CROSS(DIFF,DEA)),0);

前次绿柱面积:=REF(绿柱面积,X1+1);

前次最低价:=REF(本次最低价,X1+1);

Y1:=IF((绿柱面积<0 AND ABS(绿柱面积)<ABS(前次绿柱面积)

AND 本次最低价<前次最低价 ),1,0);

RS1:= MACD<0 AND REF(MACD,1)<0 AND C<前次最低价

AND ABS(绿柱面积)<ABS(前次绿柱面积) AND ABS(MACD)<ABS(REF(MACD,1));

底背驰:= IF (CROSS(DIFF,DEA),REF(Y1,1),0);

DRAWTEXT(底背驰,-0.01,'底背'),COLOR00FFFF;

STICKLINE(底背驰,0,-0.01,4,0),COLOR0000FF;

DRAWICON(底背驰,0,23),COLORYELLOW;

DRAWBAND(DIFF,RGB(200,50,55),DEA,RGB(50,100,10));

遵:IF(DIFF>=DEA,DIFF,DRAWNULL),COLORRED;

守:IF(DEA>=DIFF,DEA,DRAWNULL),COLORFF9900;

纪:IF(DIFF>=DEA,DEA,DRAWNULL),COLOR00FFFF;

律:IF(DEA>=DIFF,DIFF,DRAWNULL),COLOR00FF00;

X2:=IF (MACD>0,BARSLAST(CROSS(DEA,DIFF)),0);

前次红柱面积:=REF(红柱面积,X2+1);

前次最高价:=REF(本次最高价,X2+1);

Y2:=IF((红柱面积>0 AND 红柱面积<前次红柱面积 AND 本次最高价>前次最高价 ),1,0);

RS2:= MACD>0 AND REF(MACD,1)>0 AND C>前次最高价 AND ABS(红柱面积)<ABS(前次红柱面积) AND ABS(MACD)<ABS(REF(MACD,1));

顶背驰:= IF (CROSS(DEA,DIFF),REF(Y2,1),0);

DRAWICON(顶背驰,0,19),COLOR00FF00;

STICKLINE(顶背驰,0,0.01,4,0),COLOR00FF00;

DRAWTEXT(顶背驰,0.01,'顶背'),COLORFF0000;

买:IFF(底背驰,0.1,0),COLOR0000FF;

卖:IFF(顶背驰,0.1,0),COLOR00FF00;

A1:=C>REF(C,4);

NT:=BARSLASTCOUNT(A1);

TJ11:=NT=9;

TJ13:=ISLASTBAR AND BETWEEN(NT,5,8);

AY:=(BACKSET(TJ11>0,9) OR BACKSET(TJ13>0,NT))*NT;

DRAWTEXT(AY>0,MACD*1.02,VAR2STR(AY,0)),COLORLIRED;

DRAWTEXT(NT=9,MACD*1.02,'9'),COLORGREEN;

B1:=C<REF(C,4);

NT0:=BARSLASTCOUNT(B1);

TJ21:=NT0=9 ;

TJ23:=ISLASTBAR AND BETWEEN(NT0,5,8);

AY1:=(BACKSET(TJ21>0,9) OR BACKSET(TJ23>0,NT0))*NT0;

DRAWTEXT(AY1>0,MACD*0.98,VAR2STR(AY1,0)),COLORGREEN;

DRAWTEXT(NT0=9,MACD*0.98,'9'),COLORRED;



 

{股票教程网-承接通达信软件和公式破解,普通加密破解,完全加密破解,导入密码破解,时间限制破解,公式编写,可按您的要求写公式指标,价格按难度不同报价,有需要可以找我们}