多头止损:=(enterprice-close)/enterprice>zs;
多头止盈:=((hhv(h,enterbars+1)-enterprice)-(close-enterprice))/(hhv(h,enterbars+1)-enterprice)>zy;
空头止损:=(close-enterprice)/close>zs;
空头止盈:=(enterprice-(llv(l,enterbars+1))-(enterprice-close))/enterprice-(llv(l,enterbars+1))>zy;
if holding=0 and 开多条件 THEN BEGIN
开多:BUY(1,ss,MARKET)COLORRED;
end
if holding=0 and 开空条件 THEN BEGIN
开空:BUYSHORT(1,ss,MARKET)COLORGREEN;
end
//止损止盈控制=======================================
if holding>0 and 多头止损 THEN BEGIN
多止:SELL(1,ss,MARKET)COLORYELLOW;
end
if holding>0 and 多头止盈 THEN BEGIN
多盈:SELL(1,ss,MARKET)COLORYELLOW;
end
//===================================================
if holding<0 and 空头止损 THEN BEGIN
空止:SELLSHORT(1,ss,MARKET)COLORYELLOW;
end
if holding<0 and 空头止盈 THEN BEGIN
空盈:SELLSHORT(1,ss,MARKET)COLORYELLOW;
end