MB1:=EMA(WINNER(C)*100,5);
MB2:=EMA(MB1,2);
MB3:=EMA(MB2,2);
MB4:=EMA(MB3,2);
N:=5;
VAR2:=MB1;
VAR3:=DRAWLINE(VAR2>=HHV(VAR2,N)=1,VAR2,VAR2<=LLV(VAR2,N)=1,VAR2,0);
顶:=IF(VAR2=VAR3,VAR2,DRAWNULL);
XG:=REF(VAR2,1)=REF(VAR3,1) AND VAR2>REF(VAR2,1);
买入条件:=TFILTER(XG,顶,1);
卖出条件:=TFILTER(顶,XG,0);
买入价:=IF(买入条件,C,DRAWNULL);
卖出价:=IF(卖出条件,C,DRAWNULL);
DRAWICON(买入条件,L*0.98,1);
DRAWICON(卖出条件,H*1.02,2);
DRAWNUMBER(买入条件,L*0.96,买入价),COLORRED;
DRAWNUMBER(买入条件,L*0.94,REF((H+L)/2,1)),COLORLIRED;
DRAWNUMBER(卖出条件,H*1.04,卖出价),COLORGREEN;
DRAWNUMBER(卖出条件,H*1.06,REF((H+L)/2,1)),COLORLIGREEN;
DRAWNUMBER(卖出条件,H*1.08,(C/REF(C,BArslAST(买入条件))-1)*100),COLORYELLOW;
大盘分:=IF(INDEXC>MA(INDEXC,5),3,0);
板块分:=IF(HY_INDEXC>MA(HY_INDEXC,5),2,0);
个股分:=IF(C>MA(C,5),1,0);
打分和:=大盘分+板块分+个股分;
AA1:=STRCAT(CON2STR(打分和,0),'成');
AA2:=STRCAT('仓位:',AA1);
DRAWTEXT_FIX(ISLASTBAR,0.50,0.0,0,AA2),COLORCYAN;
MA(C,5);