通达信MACD_COLA算法副图指标源码

[复制链接]
查看136 | 回复0 | 2021-8-26 22:35:35 | 显示全部楼层 |阅读模式

以下是通达信MACD_COLA算法副图指标源码(无源码的请下载附件导入)

DIF:(2*EMA(CLOSE,12)-EMA(EMA(CLOSE,12),12)-(2*EMA(CLOSE,26)-EMA(EMA(CLOSE,26),26)))/2.2;
 DEA:2.1*EMA(DIF,9)-EMA(EMA(DIF,9),9);
 MACD:2.8*(DIF-DEA),COLORSTICK;
 DRAWICON(REF(DIF,1)>REF(DIF,2) AND DIF<REF(DIF,1) AND DIF>0 AND DIF>DEA,DIF*1.1,2),COLORGREEN;
 DRAWICON(CROSS(DEA,DIF) AND DIF>0,DIF,37),COLORGREEN;
 DRAWICON(REF(DIF,1)<REF(DIF,2) AND DIF>REF(DIF,1) AND DIF<0 AND DIF<DEA,DIF*1.1,1),COLORRED;
 DRAWICON(CROSS(DIF,DEA) AND DIF<0,DIF,36),COLORRED;
 X_1:=MACD<0 AND MACD>REF(MACD,1) AND REF(MACD,1)<REF(MACD,2) AND REF(MACD,2)<REF(MACD,3) AND REF(MACD,3)<REF(MACD,4);
 STICKLINE(X_1,0,MACD,0.3,0),COLORRED;
 X_2:=MACD>0 AND MACD<REF(MACD,1) AND REF(MACD,1)>REF(MACD,2) AND REF(MACD,2)>REF(MACD,3) AND REF(MACD,3)>REF(MACD,4);
 STICKLINE(X_2,0,MACD,0.3,0),COLORGREEN;
 X_3:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9));
 X_4:=SMA(X_3,9,3);
 X_5:=SMA(X_4,9,3);
 X_6:=3*X_4-2*X_5;
 X_7:=CROSS(X_4,X_5);
 X_8:=CROSS(X_5,X_4);
 X_9:=REF(CLOSE,1);
 X_10:=SMA(MAX(CLOSE-X_9,0),6,1)/SMA(ABS(CLOSE-X_9),6,1)*100;
 X_11:=CROSS(DIF,DEA) AND (X_7 OR (X_6<20 AND X_10<20));
 X_12:=CROSS(DEA,DIF) AND (X_8 OR (X_6>80 AND X_10>80));
 DRAWICON(X_11,DEA*1,25);
 DRAWICON(X_12,DEA*1,24);
 X_13:=100-100*(HHV(HIGH,40)-CLOSE)/(HHV(HIGH,40)-LLV(LOW,40))-50;
 NOTEXTLU:IF(X_13>24.99,DIF,DRAWNULL),COLORRED,LINETHICK2;
 NOTEXTLU2:IF(X_13<(-40.009998),DIF,DRAWNULL),COLORGREEN,LINETHICK2;
 NOTEXT0:0,DOTLINE,COLORLIGRAY;
 X_14:=IF(PERIOD=0,0.7,IF(PERIOD=1,1.2,IF(PERIOD=2,2,IF(PERIOD=3,2.5,IF(PERIOD=4,3,IF(PERIOD=5,5.5,IF(PERIOD=6,6,IF(PERIOD=7,7,IF(PERIOD=8,3.5,4)))))))));
 X_15:=BARSLAST(CROSS(MACD,0));
 X_16:=REF(X_15,1)>0 AND X_15=0;
 X_17:=BARSLAST(X_16);
 X_18:=REF(X_15,X_17+1);
 X_19:=HHVBARS(MACD,X_17+X_18);
 X_20:=IF(X_19>X_17,REF(MACD,X_19),0);
 X_21:=IF(X_19>X_17,REF(HIGH,X_19),0);
 X_22:=IF(REF(HIGH,1)=HHV(HIGH,X_17+X_18),REF(HIGH,1),0);
 X_23:=(X_22-X_21)/X_21*100;
 X_24:=COUNT(CROSS(0,MACD),X_17+X_18);
 X_25:=MACD>0 AND MACD<X_20 AND HIGH=HHV(HIGH,X_17+X_18) AND X_20>0 AND X_24=1;
 X_26:=REF(X_25,1) AND HIGH<REF(HIGH,1) AND MACD>0 AND X_20>0;
 X_27:=LLVBARS(MACD,X_17+X_18);
 X_28:=IF(X_27>X_17,REF(MACD,X_27),0);
 X_29:=IF(X_27>X_17,REF(LOW,X_27),0);
 X_30:=IF(REF(LOW,1)=LLV(LOW,X_17+X_18),REF(LOW,1),0);
 X_31:=(X_29-X_30)/X_29*100;
 X_32:=COUNT(CROSS(MACD,0),X_17+X_18);
 X_33:=MACD<0 AND MACD>X_28 AND LOW=LLV(LOW,X_17+X_18) AND X_28<0 AND COUNT(CROSS(MACD,0),X_17+X_18)<=3;
 X_34:=REF(X_33,1) AND LOW>REF(LOW,1) AND MACD<0 AND X_28<0;
前高:IF(X_26,X_21,DRAWNULL),NODRAW,COLOR7FFF00;
现高:IF(X_26,X_22,DRAWNULL),NODRAW,COLORGREEN;
幅度_顶:IF(X_26,X_23,DRAWNULL),NODRAW,COLORYELLOW;
原低:IF(X_34,X_29,DRAWNULL),NODRAW,COLORLIMAGENTA;
现低:IF(X_34,X_30,DRAWNULL),NODRAW,COLORRED;
幅度_底:IF(X_34,X_31,0),NODRAW,COLORYELLOW;
 DRAWICON(X_34,MACD,26);
 DRAWICON(X_26,MACD,27);
 X_35:=BACKSET(X_26,X_19+1);
 X_36:=BACKSET(X_34,X_27+1);
 NOTEXTMACDL:DRAWLINE(REF(X_36,1)=0 AND X_36=1 AND MACD<0,MACD,X_34,MACD,0),COLORRED;
 NOTEXTMACDH:DRAWLINE(REF(X_35,1)=0 AND X_35=1 AND MACD>0,MACD,X_26,MACD,0),COLORGREEN;
涨家数:INDEXADV,NODRAW,COLORRED;
跌家数:INDEXDEC,NODRAW,COLORGREEN;
正量能:涨家数/(涨家数+跌家数)*100,NODRAW,COLORMAGENTA;
负量能:跌家数/(涨家数+跌家数)*100,NODRAW,COLORYELLOW;

85066193.png

85066193.png

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则