Macd中最基础的就是两条线:diff与dea,它们之间形成的源码公式如下:
//均衡与随行源码
DRAWGBKLAST(C>0,STRIP(RGB(145,145,185),RGB(140,140,180),1));
N1:=10; N2:=22; M:=7.5;
DIF:(EMA(C,N1)-EMA(C,N2))/(1+EMA(ABS(C),512))*7.5,COLOR0000FF;
DEA:EMA(DIF,M),COLOR09FFFF;
MACD:=2*(DIF-DEA),COLORSTICK;
PARTLINE(DIF,DIF>=REF(DIF,1),RGB(250,0,0),DIF
均衡:SMA(DIF,4,2),Color00FF00,LINETHICK1;
随行:IF(MACD< 0,MACD,0),ColorFFFFFF,LINETHICK1;
D2:=MACD;
STICKLINE(D20,0,D2,5,0),Color979700;
STICKLINE(D20,0,D2,4,0),ColorB5B500;
STICKLINE(D20,0,D2,3,0),ColorD2D200;//兰
STICKLINE(D2>REF(D2,1)AND D2,0,D2,5,0),Color97004B;
STICKLINE(D2>REF(D2,1)AND D2,0,D2,4,0),ColorB5005A;
STICKLINE(D2>REF(D2,1)AND D2,0,D2,3,0),ColorD20069;//紫
STICKLINE(D2>REF(D2,1)AND D2>0,0,D2,5,0),Color970097;
STICKLINE(D2>REF(D2,1)AND D2>0,0,D2,4,0),ColorB500B5;
STICKLINE(D2>REF(D2,1)AND D2>0,0,D2,3,0),ColorD200D2;//粉
//绿柱数
VAR1:=(EMA(C,N1)-REF(EMA(C,N1),1))/REF(EMA(C,N1),1);
VAR2:=(EMA(C,N2)-REF(EMA(C,N2),1))/REF(EMA(C,N2),1);
STICKLINE(VAR1>=VAR2 AND VAR2>0 AND C>EMA(C,N2),0,MACD,5,1),COLOR000066;
STICKLINE(VAR1>=VAR2 AND VAR2>0 AND C>EMA(C,N2),0,MACD,4,1),COLOR000077;
STICKLINE(VAR1>=VAR2 AND VAR2>0 AND C>EMA(C,N2),0,MACD,3,1),COLOR000099;
A:=MACD>0;
绿柱数:=BARSLAST(A)=5;
STICKLINE(绿柱数>REF(D2,1)AND 绿柱数>=0,0,D2,5,0),COLOR00AA00;
STICKLINE(绿柱数>REF(D2,1)AND 绿柱数>=0,0,D2,4,0),COLOR00CC00;
STICKLINE(绿柱数>REF(D2,1)AND 绿柱数>=0,0,D2,3,0),COLOR00EE00;//绿柱
OSC:=100*(CLOSE-MA(CLOSE,11.5));
MAOSC:=EMA(OSC,4.5);
STICKLINE(MACD>REF(MACD,1)AND CROSS(OSC,MAOSC),0,MACD,5,0),COLOR09FFFF;
在了解以上的基本源码之后,投资者需要做的就是将第一部分均衡与随行的源码导入到相应的软件中,观察其中的指标变化:
将绿柱数相关的代码加入软件中获得的图形走势如下:
当然不同的指标代码会显示出不同的图形走势,因为这些指标的源码是可以进行编制或者修改的,投资者可以在学会一定的指标编译原理之后,在进行修改,比如是macd绿区掉头的源码:
SHORT:=12;
LONG:=26;
M:=9;
N:=30;
DIFF : EMA(CLOSE,SHORT) - EMA(CLOSE,LONG);
DEA : EMA(DIFF,M);
MACD : 2*(DIFF-DEA);
MACDBUY1 : IF(REF(MACD,1)>LLV(MACD,N),0,1);
MACDBUY2 : IF(CLOSE>MA(CLOSE,25),1,0);
MACDBUY3 : IF(MA(CLOSE,99)>CLOSE,1,0);
MACDBUY4 : IF(MACD<0,1,0);
MACDBUY:MACDBUY1+MACDBUY2+MACDBUY3+MACDBUY4;
导入之后的图形显示如下:
上一篇:股票转债是什么意思
下一篇:上升楔形整理形态如何操作