MACD底背離的通達(dá)信選股公式MACD底背離的通達(dá)信公式1
A1:=BARSLAST(REF(CROSS("MACD.DIF"(12,26,9),"MACD.DEA"(12,26,9)),1)); B1:=REF(C,A1+1)>C AND REF("MACD.DIF"(12,26,9),A1+1)<"MACD.DIF"(12,26,9) AND CROSS("MACD.DIF"(12,26,9),"MACD.DEA"(12,26,9)); MACD底背離:=FILTER(B1>0,5); STICKLINE(MACD底背離,0,0.75,3,0),COLORGREEN; DRAWTEXT(MACD底背離,0.57,'MACD底背離'),COLORGREEN; A2:=BARSLAST(REF(CROSS("KDJ.K"(9,3,3),"KDJ.D"(9,3,3)),1)); B2:=REF(C,A2+1)>C AND REF("KDJ.K"(9,3,3),A2+1)<"KDJ.K"(9,3,3) AND CROSS("KDJ.K"(9,3,3),"KDJ.D"(9,3,3)); KDJ底背離:=FILTER(B2>0,5); STICKLINE(KDJ底背離,0,1,3,0),COLORYELLOW; DRAWTEXT(KDJ底背離,0.80,'KDJ底背離'),COLORYELLOW; A3:=BARSLAST(REF(CROSS("RSI.RSI1"(6,12,24),"RSI.RSI2"(6,12,24)),1)); B3:=REF(C,A3+1)>C AND REF("RSI.RSI1"(6,12,24),A3+1)<"RSI.RSI1"(6,12,24) AND CROSS("RSI.RSI1"(6,12,24),"RSI.RSI2"(6,12,24)); RSI底背離:=FILTER(B3>0,5); STICKLINE(RSI底背離,0,0.5,3,0),COLORFFCC66; DRAWTEXT(RSI底背離,0.25,'RSI底背離'),COLORFFCC66; 2,COLORRED; C1:=BARSLAST(REF(CROSS("MACD.DEA"(12,26,9),"MACD.DIF"(12,26,9)),1)); D1:=REF(C,C1+1)<C AND REF("MACD.DIF"(12,26,9),C1+1)>"MACD.DIF"(12,26,9) AND CROSS("MACD.DEA"(12,26,9),"MACD.DIF"(12,26,9)); MACD頂背離:=FILTER(D1>0,5); STICKLINE(MACD頂背離,2,1.25,3,0),COLOR0066FF; DRAWTEXT(MACD頂背離,1.47,'MACD頂背離'),COLOR0066FF; C2:=BARSLAST(REF(CROSS("KDJ.D"(9,3,3),"KDJ.K"(9,3,3)),1)); D2:=REF(C,C2+1)<C AND REF("KDJ.K"(9,3,3),C2+1)>"KDJ.K"(9,3,3) AND CROSS("KDJ.D"(9,3,3),"KDJ.K"(9,3,3)); KDJ頂背離:=FILTER(D2>0,5); STICKLINE(KDJ頂背離,2,1,3,0),COLORRED; DRAWTEXT(KDJ頂背離,1.2,'KDJ頂背離'),COLORRED; C3:=BARSLAST(REF(CROSS("RSI.RSI2"(6,12,24),"RSI.RSI1"(6,12,24)),1)); D3:=REF(C,C3+1)<C AND REF("RSI.RSI1"(6,12,24),C3+1)>"RSI.RSI1"(6,12,24) AND CROSS("RSI.RSI2"(6,12,24),"RSI.RSI1"(6,12,24)); RSI頂背離:=FILTER(D3>0,5); STICKLINE(RSI頂背離,2,1.5,3,0),COLORFF00FF; DRAWTEXT(RSI頂背離,1.75,'RSI頂背離'),COLORFF00FF; 底背離:MACD底背離 OR KDJ底背離 OR RSI底背離; 頂背離:MACD頂背離 OR KDJ頂背離 OR RSI頂背離; 底背離選股(MACD,KDJ,RSI) {底背離} MACD底部金叉選股原碼: 條件選股公式:
macd背離的公式選股器 DIFF:=EMA(CLOSE,12) - EMA(CLOSE,26); DEA:=EMA(DIFF,9); MACD:=2*(DIFF-DEA); A1:=BARSLAST(REF(CROSS(DIFF,DEA),1)); B1:=REF(C,A1+1)>C AND REF(DIFF,A1+1)<DIFF AND CROSS(DIFF,DEA); FILTER(B1>0,5) 條件選股公式:
macd,RSi,kdj底背離 KDJ_K:="KDJ.K"(9,3,3);KDJ_D:="KDJ.D"(9,3,3);KDJ_J:="KDJ.J"(9,3,3); 買1:=CROSS(KDJ_J,0) OR (CROSS(KDJ_J,KDJ_K) AND KDJ_D<26); 買2:=CROSS("RSI.RSI1"(6,2,2),20) OR CROSS("RSI.RSI1"(6,12,24),"RSI.RSI2"(6,12,24)); 買3:=CROSS("MACD.DIF","MACD.DEA") OR CROSS("MACD.MACD",0); 買0:=買1+買2+買3; 買:IF(買0>1,買0,0); 通達(dá)信百發(fā)百中
{百發(fā)百中 K:100,120,105} VARA:=CLOSE/MA(CLOSE,48)*100<71*K/100; VARB:=CLOSE/MA(CLOSE,50)*100<70*K/100; VARC:=HIGH/LOW>1.078/K*100; VARD:=VARC AND COUNT(VARC,4)>2; VAR1:=CLOSE; VAR2:=MA(VAR1,6); VAR3:=MA(VAR1,24); VAR4:=MA(VAR1,32); VAR5:=MA(VAR1,62); VAR6:=MA(VAR1,105); 百:=VAR5/VAR6*100;發(fā):=VAR4/VAR2*100;中:=VAR3/VAR2*100; 財(cái):=VAR2/VAR1*100;入:=CLOSE/COST(8)*100; ((發(fā)>110/K*100 AND 入<80*K/100) OR (VARD AND (VARA OR VARB))) AND (HIGH>LOW) AND (REF(HIGH,1)>REF(LOW,1)) AND (REF(HIGH,2)>REF(LOW,2)) AND (REF(HIGH,3)>REF(LOW,3)) AND (REF(HIGH,4)>REF(LOW,4)) AND (REF(HIGH,5)>REF(LOW,5)); 1)KDJ和RSI在20以下鈍化一段時(shí)間;2)MACD綠線逐漸縮短,且DIF上穿DAE而DEA也向上運(yùn)行;3)日線向SAR靠攏并交叉;4)ROC在超賣區(qū)上穿MROC并且MROC上行;5)BOLL開口放大;6)5日線走平并上穿10日線且10日線走平并向上。
試著將上述條件編成一公式,經(jīng)測試,結(jié)果為零。于是,刪除并放寬一些條件,有如下公式:
DIFF:=EMA(CLOSE,12) - EMA(CLOSE,26); DEA:=EMA(DIFF,9); MACD:=2*(DIFF-DEA); AA1:=DIFF<0 AND DIFF>=DEA AND DEA>REF(DEA,1)AND MACD>REF(MACD,1); RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100; K:=SMA(RSV,3,1); D:=SMA(K,3,1); AA2:=3*K-2*D<25; LC:= REF(CLOSE,1); AA3:=SMA(MAX(CLOSE-LC,0),6,1)/SMA(ABS(CLOSE-LC),6,1)*100<30; ROC:=(CLOSE-REF(CLOSE,12))/REF(CLOSE,12)*100; ROCMA:=MA(ROC,6); AA4:=ROCMA<0 AND ROC>=ROCMA AND ROCMA>REF(ROCMA,1); AA5:=C<SAR(10,2,20)OR CROSS(C,SAR(10,2,20)); MID:=MA(CLOSE,26); UPPER:=MID+2*STD(CLOSE,26); AA1 AND AA2 AND AA3 AND AA4 AND AA5; 大家可再減少一些條件試試,信號(hào)會(huì)逐步增多。比如去掉最后兩個(gè)后,成功率仍是百分之百,而信號(hào)由6個(gè)增加到10個(gè)。 |
|