主图真实地显示MACD(副图 说明 源码 贴图)
可调参数来平移,以免挡住K线, 将MACD显示在主图上而又没有将主图压缩.........................
DIFZ:=EMA(C,12)-EMA(C,26);
DEAZ:=EMA(DIFZ,9);
MACDZ:=8*(DIFZ-DEAZ);
NN:=60;
A01:=REF(HIGH,NN)=HHV(HIGH,2*NN+1); B01:=FILTER(A01,NN);
C01:=BACKSET(B01,NN+1); D01:=FILTER(C01,NN);
A02:=REF(LOW,NN)=LLV(LOW,2*NN+1); B02:=FILTER(A02,NN);
C02:=BACKSET(B02,NN+1); D02:=FILTER(C02,NN);
E01:=(REF(LLV(LOW,2*NN),1)+REF(HHV(HIGH,2*NN),1))/2; E02:=(HIGH+LOW)/2;
H01:=(D01 AND NOT(D02 AND E01>=E02)) OR ISLASTBAR OR BARSCOUNT(CLOSE)=1;
L01:=(D02 AND NOT(D01 AND E01
G01:=F01>REF(F01,1); I01:=BACKSET(G01,2); LD:=I01>REF(I01,1);
WW:=BACKSET(ISLASTBAR,BARSLAST(LD)+1);
QQ:=WW>REF(WW,1);
RCC:REF(L,BARSLAST(QQ));
DRAWBAND(MACDZ+RCC,RGB(70,20,20),RCC,RGB(100,100,100));
DRAWBAND(DIFZ*4+RCC,RGB(255,140,140),EMA(DIFZ*4+RCC,9),RGB(147,234,249));
STICKLINE((RCC+MACDZ)>RCC AND (RCC+MACDZ)<=REF(RCC+MACDZ,1),RCC,RCC+MACDZ,0,0),COLOR400080;
STICKLINE((RCC+MACDZ)>RCC AND (RCC+MACDZ)>REF(RCC+MACDZ,1),RCC,RCC+MACDZ,0,0),COLOR00FFFF;
STICKLINE((RCC+MACDZ)<=RCC AND (RCC+MACDZ)<=REF(RCC+MACDZ,1),RCC,RCC+MACDZ,0,0),COLOR008080;
STICKLINE((RCC+MACDZ)<=RCC AND (RCC+MACDZ)>REF(RCC+MACDZ,1),RCC,RCC+MACDZ,0,0),COLORC080FF;
MA1:MA(CLOSE,M1);
MA2:MA(CLOSE,M2);
MA3:MA(CLOSE,M3);
MA4:MA(CLOSE,M4);