input:m(20,1,100,1);
TR1 := MAX(MAX((HIGH-LOW),ABS(REF(CLOSE,1)-HIGH)),ABS(REF(CLOSE,1)-LOW));
ATR := MA(TR1,m);
h14:ref(hhv(h,14),1);
l14:ref(llv(l,14),1);
开多h1:buy( cross(h,h14) and holding=0 ,ss,limitr,max(h14,o)+3*MINDIFF);
开空l1:buyshort( cross(l14,l) and holding=0 ,ss,limitr,min(l14,o)-3*mindiff);
开多h3:buy( cross(h,h14) and holding=0 ,ss,limitr,max(h14,o)+3*mindiff);
开空l3:buyshort(( cross(l14,l)) and holding=0 ,ss,limitr,min(l14,o)-3*mindiff);
多止盈1:h-(ENTERPRICE-mindiff)-2*ref(atr,1),noaxis;
多止损1:(enterprice+mindiff)-l-ref(atr,1),noaxis;
多止盈:sell(h-(ENTERPRICE-mindiff)>2*ref(atr,1) and type(1)=2 and enterbars>0,0,limitr,min(enterprice+2*ref(atr,1)-mindiff,o));
空止盈:sellshort((enterprice-mindiff)-l>2*ref(atr,1) and type(1)=3 and enterbars>0,0,limitr,max(enterprice-mindiff-2*ref(atr,1),o));
多止损:sell((enterprice+mindiff)-l>ref(atr,1) and type(1)=2 and enterbars>0,0,limitr,min(enterprice+mindiff-ref(atr,1),o));
空止损:sellshort(h-(ENTERPRICE+mindiff)>ref(atr,1) and type(1)=3 and enterbars>0,0,limitr,max(enterprice+ref(atr,1)+mindiff,o));
利润:NETPROFIT,NOAXIS,LINETHICK2,colorred;
最大回撤:maxdrawdown,noaxis;
平均亏损:avgloss,noaxis;