通达信MACD反推价副图指标 判断和预测股价趋势的走向 源码
SHORT:=9;
LONG:=19;
M:=7;
DIF:EMA(CLOSE,SHORT)-EMA(CLOSE,LONG);
DEA:EMA(DIF,M);
MACD:(DIF-DEA)*2,COLORSTICK;
X_1:=(M-1)/(M+1)*DEA/(1-2/(M+1));
X_2:=(MACD/2+DEA*(M-1)/(M+1))/(1-2/(M+1));
X_3:=(DIF*(SHORT+1)*(LONG+1)-(LONG+1)*(SHORT-1)*EMA(CLOSE,SHORT)+(SHORT+1)*(LONG-1)*EMA(CLOSE,LONG))/(2*(LONG+1-(SHORT+1)));
X_4:=(X_1*(SHORT+1)*(LONG+1)-(LONG+1)*(SHORT-1)*EMA(CLOSE,SHORT)+(SHORT+1)*(LONG-1)*EMA(CLOSE,LONG))/(2*(LONG+1-(SHORT+1)));
X_5:=(X_2*(SHORT+1)*(LONG+1)-(LONG+1)*(SHORT-1)*EMA(CLOSE,SHORT)+(SHORT+1)*(LONG-1)*EMA(CLOSE,LONG))/(2*(LONG+1-(SHORT+1)));
DRAWNUMBER_FIX(1,0.12,0.002,0,CONST(X_3)),COLORLIRED;
DRAWNUMBER_FIX(1,0.26,0.002,0,CONST(X_5)),COLORYELLOW;
DRAWNUMBER_FIX(1,0.4,0.002,0,CONST(X_4)),COLORFFDD44;
来函数检测结果如下:
该公式没有未来函数
解密、编写股票、期货策略请联系QQ或微信同号:88652583
相关股票指标公式
原理解析:
SHORT赋值:9
LONG赋值:19
M赋值:7
输出DIF:收盘价的SHORT日指数移动平均-收盘价的LONG日指数移动平均
输出DEA:DIF的M日指数移动平均
MACD:(DIF-DEA)*2,COLORSTICK
X_1赋值:(M-1)/(M+1)*DEA/(1-2/(M+1))
X_2赋值:(MACD/2+DEA*(M-1)/(M+1))/(1-2/(M+1))
X_3赋值:(DIF*(SHORT+1)*(LONG+1)-(LONG+1)*(SHORT-1)*收盘价的SHORT日指数移动平均+(SHORT+1)*(LONG-1)*收盘价的LONG日指数移动平均)/(2*(LONG+1-(SHORT+1)))
X_4赋值:(X_1*(SHORT+1)*(LONG+1)-(LONG+1)*(SHORT-1)*收盘价的SHORT日指数移动平均+(SHORT+1)*(LONG-1)*收盘价的LONG日指数移动平均)/(2*(LONG+1-(SHORT+1)))
X_5赋值:(X_2*(SHORT+1)*(LONG+1)-(LONG+1)*(SHORT-1)*收盘价的SHORT日指数移动平均+(SHORT+1)*(LONG-1)*收盘价的LONG日指数移动平均)/(2*(LONG+1-(SHORT+1)))
DRAWNUMBER_FIX(1,0.12,0.002,0,CONST(X_3)),COLORLIRED
DRAWNUMBER_FIX(1,0.26,0.002,0,CONST(X_5)),画黄色
DRAWNUMBER_FIX(1,0.4,0.002,0,CONST(X_4)),COLORFFDD44