通达信主趋势MACD副图源码



DIF:EMA(CLOSE,12)-EMA(CLOSE,26),COLORGREEN;
DEA:EMA(DIF,9),COLORBLUE;
MACD:(DIF-DEA)*2,COLORSTICK;
IF(DIF>REF(DIF,1),DIF,DRAWNULL),COLORRED,LINETHICK2;
IF(DEA>REF(DEA,1),DEA,DRAWNULL),COLORRED,LINETHICK2;
STICKLINE(((MACD<REF(MACD,1)) AND (MACD>0)),0,MACD,0.05,0),COLORLIBLUE,LINETHICK2;
STICKLINE(((MACD>REF(MACD,1)) AND (MACD<0)),0,MACD,0.05,0),COLORFF00FF,LINETHICK2;

 
NH:=REF(DIF,3)>=REF(DIF,2) AND REF(DIF,2)>=REF(DIF,1) AND DIF>REF(DIF,1)*1.1;
NH1:=ABS((REF(DIF,1)-REF(DEA,1))/REF(DIF,1))<=0.2;
DT:=REF(DIF,2)>REF(DEA,2) AND REF(DIF,1)>=REF(DEA,1) AND DIF>DEA;
NLZ:=MACD>REF(MACD,1) AND DIF>0;
NLZ1:=MACD>REF(MACD,1) AND DIF<0;
将死不死1:=(NH1 AND NH AND DT AND NLZ);
将死不死0:=(NH1 AND NH AND DT AND NLZ1);
将死不死:将死不死1 OR 将死不死0,NODRAW;
DRAWICON(将死不死,DEA-0.01,38);
DRAWICON(将死不死,DEA-0.03,38);
DRAWICON(CROSS(DIF,DEA),DEA,9);
DRAWICON(CROSS(DEA,DIF),DIF,15);
AB1:=BARSLAST(REF(CROSS(DIF,DEA),1));
底背离:=REF(CLOSE,AB1+1)>CLOSE AND DIF>REF(DIF,AB1+1) AND CROSS(DIF,DEA);
DRAWLINE(AB1=0,DEA,底背离,DEA,0),COLORYELLOW,LINETHICK1;
AB2:=BARSLAST(REF(CROSS(DEA,DIF),1));
顶背离:=REF(CLOSE,AB2+1)<CLOSE AND REF(DEA,AB2+1)>DEA AND CROSS(DEA,DIF);
DRAWLINE(AB2=0,DEA,顶背离,DEA,0),COLORGREEN,LINETHICK1;
DRAWTEXT(底背离>0,DEA,'底背离'),COLORYELLOW;
DRAWTEXT(顶背离>0,DEA,'顶背离'),COLORGREEN;
VA:=IF(CLOSE>REF(CLOSE,1),VOL,-VOL);
OBV1:=SUM(IF(CLOSE=REF(CLOSE,1),0,VA),0);
OBV2:=EMA(OBV1,3)-MA(OBV1,9);
OBV3:=EMA(IF(OBV2>0,OBV2,0),3);
MAC3:=MA(C,3);
SHORT:=12;LONG:=26;MID:=9;
STICKLINE(OBV3>REF(OBV3,1) AND MAC3>REF(MAC3,1),0,MACD,2,0),COLORYELLOW;
{持币:STICKLINE((SAR(10,2,20)>=H),MACD,0,1.5,0),COLORGREEN;
持股:STICKLINE((SAR(10,2,20)<=L),0,MACD,1.5,0),COLORYELLOW;}

 
ZSC:=CROSS(DEA#WEEK,DIF#WEEK);
ZSC1:=CROSS(DEA,DIF);
PC:=IF(EXISTR(ZSC,7,1),0,1);
PC1:=IF(EXISTR(ZSC1,7,1),0,1);
Q1:=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);
SCL:=EXISTR(CROSS(DEA,DIF),9,1);
C1:=BARSLAST(REF(Q1,1));
C2:=REF(MACD,C1+1)<MACD AND Q1 AND DIF<0 ;
TJ:=MACD>0;T:=MACD<0;
A:=LLV(MACD,50)=MACD;
DRAWICON(A AND FILTERX(A,20), MACD,1);
DRAWTEXT(BARSLAST(TJ)=1,MACD,'1'),COLORYELLOW;
DRAWTEXT(BARSLAST(TJ)=2,MACD,'2'),COLORYELLOW;
DRAWTEXT(BARSLAST(TJ)=3,MACD,'3'),COLORYELLOW;
DRAWTEXT(BARSLAST(TJ)=5,MACD,'5'),COLORYELLOW;
DRAWTEXT(BARSLAST(TJ)=8,MACD,'8'),COLORYELLOW;
DRAWTEXT(BARSLAST(TJ)=13,MACD,'13'),COLORYELLOW;
DRAWTEXT(BARSLAST(TJ)=21,MACD,'21'),COLORYELLOW;
DRAWTEXT(BARSLAST(TJ)=34,MACD,'34'),COLORYELLOW;
DRAWTEXT(BARSLAST(TJ)=55,MACD,'55'),COLORYELLOW;
DRAWTEXT(BARSLAST(T)=1,MACD,'1'),COLORGREEN;
DRAWTEXT(BARSLAST(T)=2,MACD,'2'),COLORGREEN;
DRAWTEXT(BARSLAST(T)=3,MACD,'3'),COLORGREEN;
DRAWTEXT(BARSLAST(T)=5,MACD,'5'),COLORGREEN;
DRAWTEXT(BARSLAST(T)=8,MACD,'8'),COLORGREEN;
DRAWTEXT(BARSLAST(T)=13,MACD,'13'),COLORGREEN;
DRAWTEXT(BARSLAST(T)=21,MACD,'21'),COLORGREEN;
DRAWTEXT(BARSLAST(T)=34,MACD,'34'),COLORGREEN;
DRAWTEXT(BARSLAST(T)=55,MACD,'55'),COLORGREEN;

 
X_1:=(CLOSE-EMA(CLOSE,5))/EMA(CLOSE,5)*100;
X_2:=(CLOSE-EMA(CLOSE,10))/EMA(CLOSE,10)*100;
X_3:=(CLOSE-EMA(CLOSE,20))/EMA(CLOSE,20)*100;
X_4:=(CLOSE-EMA(CLOSE,60))/EMA(CLOSE,60)*100;
X_5:=(CLOSE-EMA(CLOSE,120))/EMA(CLOSE,120)*100;
X_6:=X_1>1 AND X_2>2 AND X_3>3 AND X_4>4;
X_7:=X_1>2 AND X_2>4 AND X_3>6 AND X_4>8;
X_8:=X_1>3 AND X_2>5 AND X_3>7 AND X_4>9;
X_9:=X_1>4 AND X_2>6 AND X_3>8 AND X_4>10 AND X_5>12;
X_10:=BARSLASTCOUNT(X_7)=1 AND CROSS(CLOSE,EMA(CLOSE,50)*1.19) AND HIGH/CLOSE<1.05;{指标众筹QQ 115534139}
小鱼:BARSLASTCOUNT(X_6),NODRAW,COLORWHITE;
红鱼:BARSLASTCOUNT(X_7),NODRAW,COLORRED;
紫鱼:BARSLASTCOUNT(X_8),NODRAW,COLORMAGENTA;
黄鱼:BARSLASTCOUNT(X_9),NODRAW,COLORYELLOW;



未来函数检测结果如下:
该公式包含未来函数:#WEEK
解密、编写股票、期货策略请联系QQ或微信同号:88652583
相关股票指标公式

联系我们  |  指标公式网  |  指标网   |  指标公式  |   加入收藏   |  设为主页

@2005-2023 浙ICP备2024071487号-2 指标公式网别名指标网仅为互联网文章,所有指标公式及文章仅供学习研究,并不构成投资建议,请勿以此为依据进行股票交易,由此引起的投资亏损与本站无关。指标公式网均来源互联网收集整理,如不慎侵犯了你的权益,请联系我们告知,我们将做删除处理
QQ:88652583 微信 88652583
sitemap站点地图