通达信量化MACD趋势副图指标 源码分享 附图
DIFF:=( EMA(CLOSE,12) - EMA(CLOSE,26));
DEA:=EMA(DIFF,9);
MACD:=2*(DIFF-DEA),STICK;
STICKLINE(DIFF< 0,0,DIFF,2,0),COLORGREEN;
STICKLINE(DIFF>=0,0,DIFF,2,0),COLORRED;
STICKLINE(DEA>=0,0,DEA,2,-1),COLOR0000CC;
STICKLINE(DEA< 0,0,DEA,2,-1),COLORGREEN;
柱1:=IF(DIFF>DEA,DIFF,0),COLORRED;
柱2:=IF(DEA< DIFF,DEA,0),COLORMAGENTA;
DRAWICON(CROSS(DIFF,DEA),柱2,1);
DRAWICON(CROSS(DEA,DIFF),DEA*1.1,2);
总涨跌比:DYNAINFO(60)/(DYNAINFO(60)+DYNAINFO(61))*100,COLORCYAN,NODRAW;
净资产:=FINANCE(34);
年ROE:FINANCE(33)/FINANCE(34)COLORCYAN,NODRAW;
PE:=DYNAINFO(39),COLORRED,NODRAW;
PB:CONST(DYNAINFO(7) / FINANCE(34))COLOREE3AB2,NODRAW;
回报率:年ROE/PB*100,COLOR0099FF,NODRAW;
M:=9;
SHORT:=12;
LONG:=26;
JCSC:=(M-1)/(M+1)*DEA/(1-2/(M+1));
DD:=(MACD/2+(DEA*(M-1)/(M+1)))/(1-2/(M+1));
DIF拐头价:=(DIFF*(SHORT+1)*(LONG+1)-(LONG+1)*(SHORT-1)*EMA(C,SHORT)+(SHORT+1)*(LONG-1)*EMA(C,LONG))/(2*((LONG+1)-(SHORT+1)))COLORCYAN,LINETHICK3;
柱变向价:=(DD*(SHORT+1)*(LONG+1)-(LONG+1)*(SHORT-1)*EMA(C,SHORT)+(SHORT+1)*(LONG-1)*EMA(C,LONG))/(2*((LONG+1)-(SHORT+1))),COLORGREEN;
DRAWTEXT_FIX(1,0.9,0.94,0,STRCAT('拐点价格: ',CON2STR(DIF拐头价,2))),COLORYELLOW;
DRAWNUMBER(DIFF>DEA,3,BARSLAST(CROSS(DIFF,DEA))+1),COLORRED,NODRAW;
DRAWNUMBER(DIFF< DEA,-1,BARSLAST(CROSS(DEA,DIFF))+1),COLORGREEN,NODRAW;
DRAWTEXT_FIX(1,0.0,0.95,0,STRCAT('停止操作: ',CON2STR(CLOSE< MA(CLOSE,60),2))),COLORCYAN;
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);
STICKLINE(OBV3>REF(OBV3,1) AND MAC3>REF(MAC3,1),0,DEA/4,2,0),COLORYELLOW;
未来函数检测结果如下:
该公式包含未来函数:DYNAINFO
该公式包含未来函数:FINANCE
解密、编写股票、期货策略请联系QQ或微信同号:88652583
相关股票指标公式
原理解析:
DIFF赋值:( 收盘价的12日指数移动平均 - 收盘价的26日指数移动平均)
DEA赋值:DIFF的9日指数移动平均
MACD赋值:2*(DIFF-DEA),STICK
当满足条件DIFF< 0时,在0和DIFF之间画柱状线
当满足条件DIFF>=0时,在0和DIFF之间画柱状线
当满足条件DEA>=0时,在0和DEA之间画柱状线
当满足条件DEA< 0时,在0和DEA之间画柱状线
如果DF>DEA返回DIFF否则返回0
如果DEA< DF返回DEA否则返回0
DRAWICON(DIFF上穿DEA,柱2,1)
DRAWICON(DEA上穿DIFF,DEA*1.1,2)
输出总涨跌比:DYNAINFO(60)/(DYNAINFO(60)+DYNAINFO(61))*100,画青色,NODRAW
净资产赋值:FINANCE(34)
输出年ROE:FINANCE(33)/FINANCE(34)画青色,NODRAW
PE赋值:DYNAINFO(39),画红色,NODRAW
输出PB:CONST(现价 / FINANCE(34))COLOREE3AB2,NODRAW
输出回报率:年ROE/PB*100,COLOR0099FF,NODRAW
M赋值:9
SHORT赋值:12
LONG赋值:26
JCSC赋值:(M-1)/(M+1)*DEA/(1-2/(M+1))
DD赋值:(MACD/2+(DEA*(M-1)/(M+1)))/(1-2/(M+1))
DIF拐头价赋值:(DIFF*(SHORT+1)*(LONG+1)-(LONG+1)*(SHORT-1)*C的SHORT日指数移动平均+(SHORT+1)*(LONG-1)*C的LONG日指数移动平均)/(2*((LONG+1)-(SHORT+1)))画青色, 线宽为3
柱变向价赋值:(DD*(SHORT+1)*(LONG+1)-(LONG+1)*(SHORT-1)*C的SHORT日指数移动平均+(SHORT+1)*(LONG-1)*C的LONG日指数移动平均)/(2*((LONG+1)-(SHORT+1))),画绿色
输出DRAWTEXT_FIX(1,0.9,0.94,0,STRCAT('拐点价格: ',CON2STR(DIF拐头价,2))),画黄色
DRAWNUMBER(DIFF>DEA,3,上次DIFF上穿DEA距今天数+1),画红色,NODRAW
DRAWNUMBER(DIFF< DEA,-1,上次DEA上穿DIFF距今天数+1),画绿色,NODRAW
输出DRAWTEXT_FIX(1,0.0,0.95,0,STRCAT('停止操作: ',CON2STR(收盘价< 收盘价的60日简单移动平均,2))),画青色
VA赋值:IF(收盘价>1日前的收盘价,成交量,-成交量)
OBV1赋值:SUM(IF(收盘价=1日前的收盘价,0,VA),0)
OBV2赋值:OBV1的3日指数移动平均-OBV1的9日简单移动平均
如果OBV2>0返回OBV2否则返回0
MAC3:=C的3日简单移动平均
STICKLINE(OBV3>1日前的OBV3 AND MAC3>1日前的MAC3,0,DEA/4,2,0),画黄色