相关简介: 通达信真正的MACD背离指标公式
通达信真正的MACD背离指标公式源码概况:
指标类别:通达信指标公式
授权方式:免费版
指标评级:★★★★★
指标分类:策略
画线方法:副图
通达信真正的MACD背离指标公式源码:
SHORT:=12;LONG:=26;MID:=9;
A:=SUM(C*IF(MOD(DATETODAY(DATE),7)=0,1,0),3)*IF(PERIOD=5,1,0);
DF:=SUM(C*IF(MOD(MINUTE,5)=0,1,0),5)*IF(PERIOD=0,1,0)
+SUM(C*IF(MOD(MINUTE+55,30)=0,1,0),6)*IF(PERIOD=1,1,0)
+SUM(C*IF(HOUR-15=0,1,0),8)*IF(PERIOD=3,1,0)
+A+IF(A=0,REF(A,1),0)
+IF(REF(A,1)+A=0,REF(A,2),0)
+IF(REF(A,2)+REF(A,1)+A=0,REF(A,3),0)
+IF(REF(A,3)+REF(A,2)+REF(A,1)+A=0,REF(A,4),0)
+IF(REF(A,4)+REF(A,3)+REF(A,2)+REF(A,1)+A=0,REF(A,5),0)
+IF(REF(A,5)+REF(A,4)+REF(A,3)+REF(A,2)+REF(A,1)+A=0,REF(A,6),0);
XX:=1+4*IF(PERIOD=0,1,0)
+5*IF(PERIOD=1,1,0)
+7*IF(PERIOD=3,1,0)
+4*IF(PERIOD=5,1,0);
PDIF:EMA(DF,SHORT*XX)-EMA(DF,LONG*XX);
PDEA:EMA(PDIF,MID*XX);
PMACD:(PDIF-PDEA)*2,COLORSTICK;
CROSS(PDIF,PDEA);
LOWV:=Ema(LLV(LOW,34),3);
HIGHV:=EMA(HHV(HIGH,34),3);
RSV:=EMA((CLOSE-LOWV)/(HIGHV-LOWV)*100,3);
K:=SMA(RSV,8,1);
D:=SMA(K,6,1);
J:3*K-2*D,COLORFF00FF;
J1:MA(J,3);
A1:=BArslAst(REF(crOSS(J,J1),1));
底背离:=REF(CLOSE,A1+1)>CLOSEANDJ>REF(J,A1+1)ANDCROSS(J,J1)ANDJ<20;
STICKLINE(底背离,0,25,4,0),COLORFF00FF;
DRAWTEXT(底背离>0,30,'底背离'),COLORFFFFFF;
A2:=BARSLAST(REF(CROSS(J1,J),1));
顶背离:=REF(CLOSE,A2+1)<CLOSEANDREF(J1,A2+1)>J1ANDCROSS(J1,J)ANDJ>90;
DRAWTEXT(顶背离>0,75,'顶背离'),COLORGREEN;
STICKLINE(顶背离,100,80,4,0),COLOR00FF00;
100;
50;
0;
[源码注释]通达信真正的MACD背离指标公式翻译结果
SHORT:=12;LONG:=26;MID:=9;
A:=SUM(C*IF(MOD(DATETODAY(DATE),7)=0,1,0),3)*IF(PERIOD=5,1,0);
DF:=SUM(C*IF(MOD(MINUTE,5)=0,1,0),5)*IF(PERIOD=0,1,0)
+SUM(C*IF(MOD(MINUTE+55,30)=0,1,0),6)*IF(PERIOD=1,1,0)
+SUM(C*IF(HOUR-15=0,1,0),8)*IF(PERIOD=3,1,0)
+A+IF(A=0,REF(A,1),0)
+IF(REF(A,1)+A=0,REF(A,2),0)
+IF(REF(A,2)+REF(A,1)+A=0,REF(A,3),0)
+IF(REF(A,3)+REF(A,2)+REF(A,1)+A=0,REF(A,4),0)
+IF(REF(A,4)+REF(A,3)+REF(A,2)+REF(A,1)+A=0,REF(A,5),0)
+IF(REF(A,5)+REF(A,4)+REF(A,3)+REF(A,2)+REF(A,1)+A=0,REF(A,6),0);
XX:=1+4*IF(PERIOD=0,1,0)
+5*IF(PERIOD=1,1,0)
+7*IF(PERIOD=3,1,0)
+4*IF(PERIOD=5,1,0);
PDIF:EMA(DF,SHORT*XX)-EMA(DF,LONG*XX);
PDEA:EMA(PDIF,MID*XX);
PMACD:(PDIF-PDEA)*2,COLORSTICK;
CROSS(PDIF,PDEA);
LOWV:=Ema(LLV(LOW,34),3);
HIGHV:=EMA(HHV(HIGH,34),3);
RSV:=EMA((CLOSE-LOWV)/(HIGHV-LOWV)*100,3);
K:=SMA(RSV,8,1);
D:=SMA(K,6,1);
J:3*K-2*D,COLORFF00FF;
J1:MA(J,3);
A1:=BArslAst(REF(crOSS(J,J1),1));
底背离:=REF(CLOSE,A1+1)>CLOSEANDJ>REF(J,A1+1)ANDCROSS(J,J1)ANDJ<20;
STICKLINE(底背离,0,25,4,0),COLORFF00FF;
DRAWTEXT(底背离>0,30,’底背离’),COLORFFFFFF;
A2:=BARSLAST(REF(CROSS(J1,J),1));
顶背离:=REF(CLOSE,A2+1)<CLOSEANDREF(J1,A2+1)>J1ANDCROSS(J1,J)ANDJ>90;
DRAWTEXT(顶背离>0,75,’顶背离’),COLORGREEN;
STICKLINE(顶背离,100,80,4,0),COLOR00FF00;
100;
50;
0;
评论(0)