此源码为通用源码,主要与动态均线配套使用,重点关注乖离二线在0轴附近的动向。此原理可用于其它指标编写。
HS:=V/CAPITAL;
DEM3:=EMA(Dma(C,HS*6.18),3);
DEM7:=EMA(Dma(C,HS*3.82),7);
DEM13:=EMA(Dma(C,HS*1.91),13);
DEM21:=EMA(Dma(C,HS),21);
glC:=((C/DEM3-1)*100+(C/DEM7-1)*100+(C/DEM13-1)*100)/3;
gl3:=((DEM3/DEM7-1)*100+(DEM3/DEM13-1)*100)/2;
gl7:=((DEM7/DEM13-1)*100);
gl13:=(DEM13/REF(DEM13,1)-1)*100;
gl21:=((c/DEM21-1)*100+(DEM3/DEM21-1)*100+(DEM7/DEM21-1)*100+(DEM13/DEM21-1)*100+(DEM21/REF(DEM21,1)-1)*100)/5;
乖:(glC+gl3+gl7+gl13),COLORWHITE;
离:(glC+gl3+gl7+gl13+gl21)/5,COLORGREEN;
0,COLORMAGENTA;