通达信MACD结合RSI和KDJ主图指标公式
2021/1/20 19:00:01
{使用说明:红箭头是rsi上穿买点,上行趋势加仓,下行趋势做短或者忽略,绿色箭头rsi下穿100或者逃顶标识卖出,macd绿变紫关注,紫变红分仓买入,红色持股,变黄色看趋势,结合买卖点买卖。}
涨停:=IF(REF(C,1)*1.1-C<0.2 ,1,0);
STICKLINE(涨停,OPEN,CLOSE,4,2),COLORRED;
STICKLINE(涨停,OPEN,CLOSE,0.8,0),COLORYELLOW;
STICKLINE(涨停,H,L,0,0),COLORYELLOW;
ZT:=C/REF(C,1)>1.095;
STICKLINE(MA(CLOSE,5)>REF(MA(CLOSE,5),1) AND ZT,O,C,0.6,0),COLORYELLOW;
STICKLINE(MA(CLOSE,5)<=REF(MA(CLOSE,5),1) AND ZT,O,C,0.6,0),COLORRED;
VAR6:=REF(C,1);
VAR7:=SMA(MAX(C-VAR6,0),6,1)/SMA(ABS(C-VAR6),6,1)*100;
DRAWTEXT(CROSS(82,VAR7),H*1.02,'逃顶'),COLORYELLOW;
{MACD图}
MA5:MA(C,5)COLORYELLOW;
MA10:MA(C,10)COLORGREEN,DOTLINE;
DIF:EMA(CLOSE,7) - EMA(CLOSE,19)NODRAW;
DEA:EMA(DIF,9)NODRAW;
MACD:2*(DIF-DEA),COLORSTICK,NODRAW;
NOTEXTDIF1:MA(C,20)+(MACD.DIF)*3,COLORWHITE,NODRAW;
强:IF(NOTEXTDIF1*1.002>MA(NOTEXTDIF1,2),NOTEXTDIF1,DRAWNULL),COLORRED,LINETHICK3,NODRAW;
NOTEXTDEA1:MA(C,20)+(MACD.DEA)*3,COLORYELLOW,NODRAW;
弱:IF(NOTEXTDEA1>MA(NOTEXTDEA1,2),NOTEXTDEA1,DRAWNULL),COLORMAGENTA,LINETHICK1,NODRAW;
NOTEXTOZ:MA(C,20)COLORBLUE,DOTLINE;
NOTEXTMACD:=MA(C,20)+(MACD.MACD)*3;
{DRAWICON(CROSS(NOTEXTDIF1,NOTEXTDEA1),NOTEXTDEA1*0.998,26);
DRAWICON(CROSS(NOTEXTDEA1,NOTEXTDIF1),NOTEXTDEA1*1.003,27);}
A:=REF(NOTEXTDIF1,1)<REF(NOTEXTDIF1,2) AND REF(NOTEXTDIF1,2)<REF(NOTEXTDIF1,3) AND NOTEXTDIF1>REF(NOTEXTDIF1,1);
B:=REF(NOTEXTDIF1,1)>REF(NOTEXTDIF1,2) AND REF(NOTEXTDIF1,2)>REF(NOTEXTDIF1,3) AND NOTEXTDIF1<REF(NOTEXTDIF1,1);
{DRAWICON(A,NOTEXTDEA1,1);
DRAWICON(B,NOTEXTDEA1,2);}
STICKLINE(MACD>REF(MACD,1) AND MACD>0,NOTEXTOZ,NOTEXTMACD,0,-1),COLORRED;
STICKLINE(NOTEXTMACD>=NOTEXTOZ AND MACD>REF(MACD,1),NOTEXTOZ,NOTEXTMACD,0,-1),COLORRED;
STICKLINE(MACD<=REF(MACD,1) AND MACD>0,NOTEXTOZ,NOTEXTMACD,0,-1),COLORYELLOW;
TC1:=IF(H=HHV(H,48),H,DRAWNULL);
TC2:=CONST(BARSLAST(TC1=H))+1;
UPPER:=CONST(IF(TC2=1,H,REF(H,TC2-1)));
BC1:=IF(L=LLV(L,48),L,DRAWNULL);
BC2:=CONST(BARSLAST(BC1=L))+1;
LOWER:=CONST(IF(BC2=1,L,REF(L,BC2-1)));
LP:=CURRBARSCOUNT<=BC2 AND L=LOWER;
HP:=CURRBARSCOUNT<=TC2 AND H=UPPER;
底:=IF(LP,150,0),COLORMAGENTA;
DRAWICON(FILTER(底,10),L*0.925,1);
{STICKLINE(MACD<REF(MACD,1) AND MACD<0,NOTEXTOZ,NOTEXTMACD,0,-1),COLORGREEN;}
STICKLINE(NOTEXTMACD<NOTEXTOZ AND MACD<REF(MACD,1),NOTEXTMACD,NOTEXTOZ,0,-1),COLORGREEN;
STICKLINE(MACD>=REF(MACD,1) AND MACD<0,NOTEXTOZ,NOTEXTMACD,0,-1),COLORMAGENTA;
{MACD/};
{超级KDJ}
N:=9;
M1:=3;
M2:=3;
RSV:=(CLOSE-LLV(LOW,N))/(HHV(HIGH,N)-LLV(LOW,N))*100,NODRAW;
K:=SMA(RSV,M1,1),NODRAW;
D:=SMA(K,M2,1),NODRAW;
J:=3*K-2*D,NODRAW;
CJ_K:=MA(K,15),LINETHICK2,NODRAW;
CJ_D:=MA(D,15),LINETHICK2,NODRAW;
CJ_J:=MA(J,15),LINETHICK2,NODRAW;
DRAWICON(CROSS(CJ_K,CJ_D)&&CJ_D<30,L*0.92,11);
DRAWICON(CROSS(CJ_D,CJ_K)&&CJ_D>70,H*1.05,12);
DRAWICON(CROSS(CCI,-100),L*0.98,1);
DRAWICON(CROSS(CCI,0),L*0.98,1);
DRAWICON(CROSS(CCI,100),L*0.98,1);
DRAWICON(CROSS(100,CCI),H*1.02,2);
{DRAWICON(CROSS(50,CCI),H*1.02,12);};
PT1:=CONST(HHV(H,20))/1.2;
IF(CURRBARSCOUNT<=10,PT1,DRAWNULL),COLORGREEN;
DRAWTEXT(ISLASTBAR,PT1,'回马枪观测'),COLORWHITE;
PT2:=CONST(HHV(H,10))/1.2;
IF(CURRBARSCOUNT<=10,PT2,DRAWNULL),COLORGREEN;
DRAWTEXT(ISLASTBAR,PT2,'回马枪观测'),COLORWHITE;
投股 票网 www.tou 18.cn
股市公式下载推荐