以下是通达信MACD底背离(主图副图选股源码)

{主图}

DIF:=EMA(CLOSE,12)-EMA(CLOSE,26);
 DEA:=EMA(DIF,9);
 MACD:=(DIF-DEA)*2;
 T:=BARSLAST(CROSS(0,MACD));
 TA:=BARSLAST(CROSS(MACD,0));
 T2:=REF(T,TA+1)+TA+1;
 L1:=LLV(L,T+1);
 L2:=REF(L1,T+1);
 L1T:=BARSLAST(L=L1);
 M1:=REF(MACD,BARSLAST(L=L1));
 M2:=REF(M1,T+1+T+1);
 L2T:=BARSLAST(L=CONST(L2));
 TJ:=(T2-TA)>=10 AND (TA-T)>=10;
 TJ1:=L1<L2 AND M1>M2;
 EXT:DRAWLINE(L2T=0,L,L1T=0 AND TJ AND TJ1 AND T>=10 AND L2T>20 ,L,0),COLORYELLOW;
 DRAWTEXT(CROSS(EXT!=DRAWNULL,0.5),EXT*1.05,’底背离’),COLORYELLOW;

 {幅图}

DIF:EMA(CLOSE,12)-EMA(CLOSE,26);
 DEA:EMA(DIF,9);
 MACD:(DIF-DEA)*2,COLORSTICK;
 T:=BARSLAST(CROSS(0,MACD));
 TA:=BARSLAST(CROSS(MACD,0));
 T2:=REF(T,TA+1)+TA+1;
 L1:=LLV(L,T+1);
 L2:=REF(L1,T+1);
 L1T:=BARSLAST(L=L1);
 M1:=REF(MACD,BARSLAST(L=L1));
 M2:=REF(M1,T+1+T+1);
 L2T:=BARSLAST(L=CONST(L2));
 TJ:=(T2-TA)>=10 AND (TA-T)>=10;
 TJ1:=L1<L2 AND M1>M2;
 EXT:DRAWLINE(L2T=0,MACD,L1T=0 AND TJ AND TJ1 AND T>=10 AND L2T>20,MACD,0),DOTLINE,COLORMAGENTA;
 DRAWTEXT(CROSS(EXT!=DRAWNULL,0.5),MACD,’底背离’),COLORMAGENTA;

 {选股}

DIF:=EMA(CLOSE,12)-EMA(CLOSE,26);
 DEA:=EMA(DIF,9);
 MACD:=(DIF-DEA)*2;
 T:=BARSLAST(CROSS(0,MACD));
 TA:=BARSLAST(CROSS(MACD,0));
 T2:=REF(T,TA+1)+TA+1;
 L1:=LLV(L,T+1);
 L2:=REF(L1,T+1);
 L1T:=BARSLAST(L=L1);
 M1:=REF(MACD,BARSLAST(L=L1));
 M2:=REF(M1,T+1+T+1);
 L2T:=BARSLAST(L=CONST(L2));
 TJ:=(T2-TA)>=10 AND (TA-T)>=10;
 TJ1:=L1<L2 AND M1>M2;
 XG:TJ AND TJ1 AND L1T=0 AND T>=10 AND L2T>20;

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。