你好我要日内在每个小结尾盘清仓所有方向持仓!如铜,晚上12:58,中午11:28及下午14:58!清仓所有方向的持仓不再开仓,怎么写!
使用到的函数和周期有关系,所以需要明确下你交易的周期。
直接点的办法是直接做time函数的判断
cond:time=45800 or time=152800 or time=185900;//这里直接修改需要平仓的时间点
if not(cond) then
begin
sellshort(holding<0,holding,market);
sell(holding>0,holding,market);
end
另外给你的开仓条件都加个条件 BARSLAST(cond)>2 这样全平后就不会开仓了。
缺陷是不能自适应不同夜盘的时间点,需要自己修改夜盘平仓的时间点。