{乖离率是标示当下股价对某一个均线的偏差,过远就会向均线靠拢,所以看走势的时候必须明了
股价和均线的位置,这个公式就是对K线做短时平滑,设置需要选择的均线值}
{M1:2 M2:60}
MID1:=(3*CLOSE+LOW+OPEN+HIGH)/6;
乖离率:(SMA(MID1,M1,1)-MA(SMA(MID1,2,1),M2))/MA(SMA(MID1,2,1),M2)*100,COLOR999999;
MID:=乖离率;
MA1:(10*MID+9*REF(MID,1)+8*REF(MID,2)+7*REF(MID,3)+6*REF(MID,4)+5*REF(MID,5)
+4*REF(MID,6)+3*REF(MID,7)+2*REF(MID,8)+1*REF(MID,9))/55,COLOR0000DD;
MA2:EMA(MA1,8),COLORWHITE; {MA1取普通平均值}
IF(MA1<=REF(MA1,1) ,MA1,DRAWNULL),COLOR22FF22;
IF(MA2<=REF(MA2,1),MA2,DRAWNULL),COLOR33FF33;
{长中短周期把握}
N1A:=BARSLAST(CROSS(C,MA(C,13)));
N2A:=BARSLAST(CROSS(MA(C,13),C));
短线跟踪:IF(N1A
N2B:=BARSLAST(CROSS(MA(C,60),C));
中线跟踪:IF(N1B
N2C:=BARSLAST(CROSS(MA(C,250),C));
长线跟踪:IF(N1C