N:=9;
中轨值:=SMA(CLOSE,N,1);
MA0:=MA(中轨值,30);
MA1:=MA(中轨值,1);
A1:=MA1-MA0;
MA2:=MA(中轨值,2);
A2:=MA2-MA0;
MA3:=MA(中轨值,3);
A3:=MA3-MA0;
MA4:=MA(中轨值,4);
A4:=MA4-MA0;
MA5:=MA(中轨值,5);
A5:=MA5-MA0;
MA6:=MA(中轨值,6);
A6:=MA6-MA0;
MA7:=MA(中轨值,7);
A7:=MA7-MA0;
MA8:=MA(中轨值,8);
A8:=MA8-MA0;
MA9:=MA(中轨值,9);
A9:=MA9-MA0;
MA10:=MA(中轨值,10);
A10:=MA10-MA0;
MA11:=MA(中轨值,11);
A11:=MA11-MA0;
MA12:=MA(中轨值,12);
A12:=MA12-MA0;
MA13:=MA(中轨值,13);
A13:=MA13-MA0;
MA14:=MA(中轨值,14);
A14:=MA14-MA0;
MA15:=MA(中轨值,15);
A15:=MA15-MA0;
MA16:=MA(中轨值,16);
A16:=MA16-MA0;
MA17:=MA(中轨值,17);
A17:=MA17-MA0;
MA18:=MA(中轨值,18);
A18:=MA18-MA0;
MA19:=MA(中轨值,19);
A19:=MA19-MA0;
MA20:=MA(中轨值,20);
A20:=MA20-MA0;
MA21:=MA(中轨值,21);
A21:=MA21-MA0;
MA22:=MA(中轨值,22);
A22:=MA22-MA0;
MA23:=MA(中轨值,23);
A23:=MA23-MA0;
MA24:=MA(中轨值,24);
A24:=MA24-MA0;
MA25:=MA(中轨值,25);
A25:=MA25-MA0;
MA26:=MA(中轨值,26);
A26:=MA26-MA0;
MA27:=MA(中轨值,27);
A27:=MA27-MA0;
MA28:=MA(中轨值,28);
A28:=MA28-MA0;
MA29:=MA(中轨值,29);
A29:=MA29-MA0;
MA30:=MA(中轨值,30);
A30:=MA30-MA0;
MA31:=MA(中轨值,31);
A31:=MA31-MA0;
MA32:=MA(中轨值,32);
A32:=MA32-MA0;
MA33:=MA(中轨值,33);
A33:=MA33-MA0;
MA34:=MA(中轨值,34);
A34:=MA34-MA0;
MA35:=MA(中轨值,35);
A35:=MA35-MA0;
MA36:=MA(中轨值,36);
A36:=MA36-MA0;
MA37:=MA(中轨值,37);
A37:=MA37-MA0;
MA38:=MA(中轨值,38);
A38:=MA38-MA0;
MA39:=MA(中轨值,39);
A39:=MA39-MA0;
MA40:=MA(中轨值,40);
A40:=MA40-MA0;
LC:(A6+A7+A8+A9+A10+A11+A12+A13+A14+A15+A16+A17+A18+A19+A20)/30,LINETHICK0,COLORYELLOW;
CXH1:=LC;
CXH2:=REF(LC,1);
CXH3:=CXH1>CXH2 AND REF(LC,1)< REF(LC,2);
CXH4:=CXH1< CXH2 AND REF(LC,1)>REF(LC,2);
均线发散 : STICKLINE(CXH1>CXH2,LC,REF(LC,1),2,1),COLORRED;
均线粘合 : STICKLINE(CXH1< CXH2,LC,REF(LC,1),2,1),COLORGREEN;
EMA5:MA(CXH1,5),COLOR666666;
EMA10:MA(CXH1,10),COLOR999999;
B1:=BARSLAST(MA20>REF(MA20,1));
DRAWTEXT(CXH3 AND MA20< REF(MA20,1) AND COUNT(CXH3,B1)=1,0.95*REF(LC,1),'1金叉'),COLORYELLOW;
DRAWTEXT(CXH3 AND MA20< REF(MA20,1) AND COUNT(CXH3,B1)=2,0.95*REF(LC,1),'2金叉'),COLORYELLOW;
DRAWTEXT(CXH3 AND MA20< REF(MA20,1) AND COUNT(CXH3,B1)=3,0.95*REF(LC,1),'3金叉'),COLORYELLOW;
DRAWTEXT(CXH3 AND MA20< REF(MA20,1) AND COUNT(CXH3,B1)=4,0.95*REF(LC,1),'4金叉'),COLORYELLOW;
DRAWTEXT(CXH3 AND MA20< REF(MA20,1) AND COUNT(CXH3,B1)=5,0.95*REF(LC,1),'5金叉'),COLORYELLOW;
B2:=BARSLAST(MA20< REF(MA20,1));
DRAWTEXT(CXH4 AND MA20>REF(MA20,1) AND COUNT(CXH4,B2)=1 ,1.05*REF(LC,1),'1死叉');
DRAWTEXT(CXH4 AND MA20>REF(MA20,1) AND COUNT(CXH4,B2)=2 ,1.05*REF(LC,1),'2死叉');
DRAWTEXT(CXH4 AND MA20>REF(MA20,1) AND COUNT(CXH4,B2)=3 ,1.05*REF(LC,1),'3死叉');
DRAWTEXT(CXH4 AND MA20>REF(MA20,1) AND COUNT(CXH4,B2)=4 ,1.05*REF(LC,1),'4死叉');
MACD:=(EMA5-EMA10)*2,COLORSTICK;
减速上行: STICKLINE(CXH1>REF(CXH1,1) AND MACD< REF(MACD,1),CXH1,REF(CXH1,1),2,1),COLORLIRED;
减速下行: STICKLINE(CXH1< REF(CXH1,1) AND MACD>REF(MACD,1),CXH1,REF(CXH1,1),2,1),COLORFFFF00;