止损条件不合理吧,收盘前怎么知道当天已经最低最高价。
止损条件重新描述下(一般是多少个点止损)
hh:VALUEWHEN(todaybar=10,hhv(h,10));
ll:VALUEWHEN(todaybar=10,llv(l,10));
gg:hhv(h,todaybar);//当天最高价
dd:llv(l,todaybar);//当天最低价
if c>hh then buy(holding=0,1,market);
if c<ll then buyshort(holding=0,1,market);
//多损
la:ref(llv(l,todaybar-enterbars),enterbars);//开仓前最低价
if l<=la then sell(holding>0,holding,market);
//空损
ha:ref(hhv(h,todaybar-enterbars),enterbars);//开仓前最高价
if h>ha then sellshort(holding<0,holding,market);
//收盘前5分钟平仓
m5:=(t0totime(timetot0(closetime(0))-60*5));
if time>=m5 then begin
Sell( holding>0,1,market);
sellshort(holding<0,1,market);
end