通达信MACD买卖副图公式源码

[复制链接]
查看69 | 回复0 | 2021-8-19 20:57:30 | 显示全部楼层 |阅读模式

以下是通达信MACD买卖副图公式源码(无源码的请下载附件导入)

明 :红箭头买入;白箭头持股;绿箭头卖出。

注:请将参数:
SHDRT    2      200      12  改为:
SHORT    2      200      12  (即D改为:O)

全部参数:
SHORT    2      200      12
LONG     2      200      26
MID      2      200      9
N1       2      100      6
LL1      2      100      20
LH1      2      100      80 
(抱歉,后面漏掉参数: LL1      2      100      20
LH1      2      100      80  )
 

{MACD买卖}
M21:=MA(C,21);
M55:=MA(C,55);
A0:=M21>REF(M21,1) AND M55>REF(M55,1);
A1:=COUNT(V>REF(V,1),2)>=2;
A3:=KDJ.K>KDJ.D;
A4:=MACD.DIF>0;
A5:=CCI.CCI>100;
A6:=C>BOLL.BOLL;
{ST:=IF(NAMELIKE('S'),0,1) AND IF(NAMELIKE('*'),0,1);}
S2:=DYNAINFO(4)>0;
A0 AND A1 AND A3 AND A4 AND A5 AND A6 AND S2;
DIF:EMA(CLOSE,SHORT)-EMA(CLOSE,LONG);
DEA:EMA(DIF,MID);
MACD:(DIF-DEA)*2,COLORSTICK;
IF(DIF<REF(DIF,1),DIF,DRAWNULL),COLORGREEN,LINETHICK2;
IF(DIF>=REF(DIF,1),DIF,DRAWNULL),COLORRED,LINETHICK2;
{MACD提示};

B1:=REF(C,A1+1)> C AND REF("MACD.DIF",A1+1)<"MACD.DIF" AND CROSS("MACD.DIF","MACD.DEA");
DRAWICON(B1>0,DIF*1.21,1);{MACD底背离}
C1:=BARSLAST(REF(CROSS("MACD.DEA","MACD.DIF"),1));
D1:=REF(C,C1+1)<C AND REF("MACD.DIF",C1+1)> "MACD.DIF" AND CROSS("MACD.DEA","MACD.DIF");
DRAWICON(D1>0,DEA*1.21,2);{MACD顶背离};



WQ:="RSI.RSI1"(N1,2,2);
ENTERLONG:CROSS(WQ,LL1),COLORRED;
EXITLONG:CROSS(LH1,WQ),COLORGREEN;



DIFF:EMA(CLOSE,SHORT)-EMA(CLOSE,LONG);


ZERO:0;
GJ:=MAX(C,O);
STICKLINE(MACD>0 AND MACD>=REF(MACD,1),0,MACD,2,0),COLOR0000FF;
STICKLINE(MACD>0 AND MACD<REF(MACD,1),0,MACD,2,0),COLORFFFF00;
STICKLINE(MACD<0 AND MACD>=REF(MACD,1),0,MACD,2,0),COLORFF00FF;
STICKLINE(MACD<0 AND MACD<REF(MACD,1),0,MACD,2,0),COLOR00FF00;
L4:=LLV(GJ,4);
JL:=(HHV(DIFF,55)-LLV(DIFF,55))/5;
GT:=DEA>REF(DEA,1) AND REF(DEA,1)<REF(DEA,2);
A1Y:=BARSLAST(REF(GT,1));
底背离:=REF(L4,A1Y+1)>CLOSE AND DIFF>REF(DIFF,A1Y+1) AND GT;
DRAWLINE(A1Y=0,DEA,底背离,REF(DEA,A1Y),0),COLORRED,LINETHICK2;
DRAWLINE(底背离,DEA,底背离,REF(DEA,A1Y),0),COLORRED,LINETHICK2;
DRAWTEXT(底背离,REF(DEA,A1)*1.18,' 底背离'),COLORFF00FF;
H4:=HHV(GJ,4);
GT2:=DEA<REF(DEA,1) AND REF(DEA,1)>REF(DEA,2);
A2:=BARSLAST(REF(GT2,1));
顶背离:= REF(H4,A2+1)<H4 AND  DIFF<REF(DIFF,A2+1) AND GT2;
DRAWLINE(A2=0  ,DEA,顶背离,REF(DEA,A2),0),COLORGREEN,LINETHICK2;
DRAWLINE(顶背离,DEA,顶背离,REF(DEA,A2),0),COLORGREEN,LINETHICK2;
DRAWTEXT(顶背离,REF(DEA,A2)*1.18,' 顶背离'),COLORGREEN;
 

725455313.jpg

725455313.jpg

回复

使用道具 举报

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

本版积分规则