{使用说明:红箭头是买入信号,红数字是买入参考价,绿箭头是卖出信号,绿数字是卖出参考价,黄色数字是盈亏百分比。}
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(卖出条件,H*1.04,卖出价),COLORGREEN;
DRAWNUMBER(卖出条件,H*1.06,(C/REF(C,BARSLAST(买入条件))-1)*100),COLORYELLOW;
成交收益:=IF(卖出条件,(C/REF(C,BARSLAST(买入条件))-1)*100*0.994,DRAWNULL);
年收益:=SUM(成交收益,250);
年成交数:=IF(ISLASTBAR,SUM(卖出条件,250),DRAWNULL);
DRAWTEXT_FIX(ISLASTBAR,0.00,0.00,0,STRCAT( 年交易次数: ,CON2STR(年成交数,0))),COLORLIRED;
DRAWTEXT_FIX(ISLASTBAR,0.00,0.05,0,STRCAT( 年交易收益: ,CON2STR(年收益,2))),COLORLIRED;