同花顺MACD之中轨公式 MA对中轨的拉力
类同于常规MACD用法;注意添加的金叉死叉等信号
源码
MA$1:=MA(CLOSE, N);
MA20:=MA(C,20);MA60=MA(C,60);
MID:=IF (CLOSE>MA(CLOSE,55),MA(HIGH,23),MA(LOW,34));
UP:=MID+2*STD(CLOSE,26);
dn:=MID-2*STD(CLOSE,26);
MID1=MA(CLOSE,20);
UPPER:=MID1 + 3*STD(CLOSE,21);
VAR2:=CLOSE*VOL;
VAR3:=EMA((EMA(VAR2,3)/EMA(VOL,3)+EMA(VAR2,6)/EMA(VOL,6)+EMA(VAR2,12)/EMA(VOL,12)+EMA(VAR2,24)/EMA(VOL,24))/4,13);
SUP:=1.06*VAR3;
SDN:=VAR3*0.94;
VAR4:=EMA(CLOSE,9);
LUP:=EMA(VAR4*1.14,5);
LDN:=EMA(VAR4*0.86,5);
中轨=(sup+sdn+Lup+Ldn+dn+UPPER+MA20)/7;
DIFF : EMA(CLOSE,n) - 中轨;
DEA:EMA(DIFF,n);
MACD : 2*(DIFF-DEA);
Zero : 0;
DRAWICON(CROSS(DIFF,DEA) ,-0.033,'buy');
DRAWICON(CROSS(DEA,DIFF) ,0.033,'sell');
DRAWTEXT(
C>REF(C,1) AND C> MA$1 AND REF(C,1)< REF(C,2) AND REF(L,1)<REF(MA$1,1) AND
COUNT(DIFF>DEA,4)=4 AND COUNT(MA$1>中轨,4)=4
, DIFF,'I'),coloryellow ;
DRAWTEXT(
C>REF(C,1) AND C> MA$1 AND REF(C,1)< REF(C,2) AND REF(L,1)<REF(MA$1,1) AND
CROSS(DIFF,DEA) AND CROSS(REF(DEA,1),REF(DIFF,1)) AND COUNT(MA$1>中轨,4)=4
, DIFF,'I'),coloryellow ;
DRAWTEXT(
CROSS(DIFF,DEA) AND MA$1>中轨 AND 中轨>MA60
AND C>MA$1 AND COUNT(C<中轨,4)=0 AND COUNT(C>中轨 AND C<MA$1 ,3)>=1
, DIFF,'A'),coloryellow ;