1. MA-YOUYU
参数: N,M1,M2,M3,M4
BOLL:MA(CLOSE,N);
UB:BOLL+2*STD(CLOSE,N),DOTLINE,COLORYELLOW;
LB:BOLL-2*STD(CLOSE,N),DOTLINE,COLORYELLOW;
MA1:MA(CLOSE,M1),LINETHICK1,COLORMAGENTA;
MA2:MA(CLOSE,M2),LINETHICK2,COLORRED;
IF(MA2>REF(MA2,1),MA2,DRAWNULL),COLORRED,LINETHICK2;
IF(MA2<REF(MA2,1),MA2,DRAWNULL),COLORGREEN,LINETHICK2;
MA3:MA(CLOSE,M3),LINETHICK3,COLORGREEN;
上翘:IF(MA3>REF(MA3,1),MA3,DRAWNULL),COLORRED,LINETHICK3;
下拐:IF(MA3<REF(MA3,1),MA3,DRAWNULL),COLORGREEN,LINETHICK3;
MA4:MA(CLOSE,M4),COLORBLUE;
2. MACD-YOUYU
DIFF:EMA(CLOSE,12)-EMA(CLOSE,26),DOTLINE;
DEA:EMA(DIFF,9);
MACD:(DIFF-DEA)*2,COLORSTICK;
高位死叉:=CROSS(DEA,DIFF) AND DIFF>0.1;
STICKLINE(高位死叉,0,0.01,6,0),COLORGREEN;
DRAWTEXT(高位死叉,DIFF,‘ 高位死叉‘),COLORGREEN;
JCCOUNT:=COUNT(CROSS(DIFF,DEA),BARSLAST(DEA>=0));
二次金叉:=CROSS(DIFF,DEA) AND DEA<0 AND COUNT(JCCOUNT=2,21)=1;
STICKLINE(二次金叉,0,-0.01,6,0),COLORRED;
DRAWICON(二次金叉,DEA*1.04,13) ;
DRAWTEXT(二次金叉,-0.01,‘ 二次金叉‘),COLORRED;
A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));
底背离:=REF(CLOSE,A1+1)>CLOSE AND DIFF>REF(DIFF,A1+1) AND CROSS(DIFF,DEA);
STICKLINE(底背离,0,0.01,6,0),COLORRED;
DRAWLINE(A1=0,DEA,底背离,DEA,0),COLORRED,LINETHICK2;
A2:=BARSLAST(REF(CROSS(DEA,DIFF),1));
顶背离:=REF(CLOSE,A2+1)<CLOSE AND REF(DIFF,A2+1)>DIFF AND CROSS(DEA,DIFF);
DRAWLINE(A2=0,DEA,顶背离,DEA,0),COLORGREEN,LINETHICK2;
DRAWICON(顶背离,DIFF*1.04,2) ;
3. KD-YOUYU
参数: N,M1,M2
RSV:=(CLOSE-LLV(LOW,N))/(HHV(HIGH,N)-LLV(LOW,N))*100;
K:SMA(RSV,M1,1);
D:SMA(K,M2,1);
4. VOL-YOUYU
参数: M1,M2,M3
TOTAL:=IF(PERIOD=1,5,IF(PERIOD=2,15,IF(PERIOD=3,30,IF(PERIOD=4,60,IF(PERIOD=5,240,1)))));
MTIME:=MOD(FROMOPEN,TOTAL);
CTIME:=IF(MTIME<0.5,TOTAL,MTIME);
VVOL:IF(CURRBARSCOUNT=1,VOL*TOTAL/CTIME,DRAWNULL),NODRAW;
STICKLINE(CURRBARSCOUNT=1 && (SETCODE=0 || SETCODE=1),VVOL,0,-1,-1),COLOR00C0C0;
VOLUME:VOL,VOLSTICK;
MAVOL1:MA(VOLUME,M1);
MAVOL2:MA(VOLUME,M2);
MAVOL3:MA(VOLUME,M3);