通达信MACD峰顶峰谷副图,红持股白持币,监控资金进出源码
DIFF1:= EMA(C,3) - EMA(C,13);
DEA1 := EMA(DIFF1,9);
MACD1:= 2*(DIFF1-DEA1)*10;
DIFF2:= EMA(C,5) - EMA(C,26);
DEA2 := EMA(DIFF2,9);
MACD2:= 2*(DIFF2-DEA2)*10;
DIFF3:= EMA(C,7) - EMA(C,89);
DEA3 := EMA(DIFF3,21);
MACD3:= 2*(DIFF3-DEA3)*10;
{DRAWGBK(C>0,COLORRGB(255,255,220),COLORRGB(5,100,255),1),COLORF80606;}
DRAWBAND(MACD3,RGB(58,158,0),0,RGB(100,100,100));
DRAWBAND(MACD2,RGB(25,125,0),0,RGB(85,85,85));
DRAWBAND(MACD1,RGB(0,100,0),0,RGB(65,65,65));
DRAWBAND(IF(MACD3>=1,-ABS(MACD3)*0.6,0),RGB(35,35,35),0,RGB(35,35,35));
DRAWBAND(IF(MACD1>=1,-ABS(MACD1)*0.6,0),RGB(15,15,15),0,RGB(15,15,15));
X1:=MA(LLV(C,8)*1.1,13);
X2:=MA(HHV(C,21)*0.9,13);
X3:=MA(LLV(INDEXC,8)*1.1,13);
X4:=MA(HHV(INDEXC,21)*0.9,13);
资金进出:=3*(MA(C,1)-(X1+X2)/2-(X1+X2)/2*((X3+X4)/2-EMA(INDEXC,3))/((X3+X4)/2));
STICKLINE(资金进出<0,资金进出,0,0.01,0),COLORCYAN;
STICKLINE(资金进出>=0,资金进出,0,0.01,0),COLORFF8BFF;
红持: (SMA(CLOSE,2,1)-EMA(LLV((CLOSE+LOW)/2,10),21))/MA(LLV((CLOSE+LOW)/2,10),21)*25,LINETHICK0,COLORRED;
白减: (SMA(CLOSE,4,1)-EMA(LLV((CLOSE+LOW)/2,10),21))/MA(LLV((CLOSE+LOW)/2,10),21)*25,LINETHICK0,COLORFFFFFF;
DRAWBAND(红持,RGB(255,0,0),白减,RGB(255,251,240));
来函数检测结果如下:
该公式没有未来函数
解密、编写股票、期货策略请联系QQ或微信同号:88652583
相关股票指标公式
原理解析:
DIFF1赋值: C的3日指数移动平均 - C的13日指数移动平均
DEA1 := DIFF1的9日指数移动平均
MACD1赋值: 2*(DIFF1-DEA1)*10
DIFF2赋值: C的5日指数移动平均 - C的26日指数移动平均
DEA2 := DIFF2的9日指数移动平均
MACD2赋值: 2*(DIFF2-DEA2)*10
DIFF3赋值: C的7日指数移动平均 - C的89日指数移动平均
DEA3 := DIFF3的21日指数移动平均
MACD3赋值: 2*(DIFF3-DEA3)*10
{ 填充背景(C>0,COLORRGB(255,255,220),COLORRGB(5,100,255),1),COLORF80606
}
DRAWBAND(MACD3,RGB(58,158,0),0,RGB(100,100,100))
DRAWBAND(MACD2,RGB(25,125,0),0,RGB(85,85,85))
DRAWBAND(MACD1,RGB(0,100,0),0,RGB(65,65,65))
DRAWBAND(IF(MACD3>=1,-MACD3的绝对值*0.6,0),RGB(35,35,35),0,RGB(35,35,35))
DRAWBAND(IF(MACD1>=1,-MACD1的绝对值*0.6,0),RGB(15,15,15),0,RGB(15,15,15))
X1赋值:8日内C最低值*1.1的13日简单移动平均
X2赋值:21日内C最高值*0.9的13日简单移动平均
X3赋值:8日内INDEXC最低值*1.1的13日简单移动平均
X4赋值:21日内INDEXC最高值*0.9的13日简单移动平均
资金进出赋值:3*(C的1日简单移动平均-(X1+X2)/2-(X1+X2)/2*((X3+X4)/2-INDEXC的3日指数移动平均)/((X3+X4)/2))
当满足条件资金进出<0时,在资金进出和0之间画柱状线
当满足条件资金进出>=0时,在资金进出和0之间画柱状线
收盘价的2日[1日权重]移动平均
收盘价的4日[1日权重]移动平均
DRAWBAND(红持,RGB(255,0,0),白减,RGB(255,251,240))