本人在策略中编写了以下代码:
//收盘前自动平仓
if time > 151338 then begin
sell(holding > 0, 0, thisclose);
sellshort(holding < 0, 0, thisclose);
end
请教:
1,上述代码采用“固定时间间隔”轮询模式,时间间隔采用1秒钟,为什么执行的结果是15:13:00就下单平仓了,是什么原因?
2,time取得的时间的本地计算机时间还是交易所行情时间?
3,要完成15:13:38后才执行自动平仓,代码应该怎么写?
谢谢!
以下是引用fly在2013-5-15 16:53:21的发言:
代码运行在几分钟周期?应用在1分钟的K线周期上
//“固定时间间隔”轮询模式,1分钟周期
if DYNAINFO(207)>151338 and islastbar then begin
sell(holding > 0, 0, thisclose);
sellshort(holding < 0, 0, thisclose);
end
if time > 151400 and not(islastbar) then begin
sell(holding > 0, 0, thisclose);
sellshort(holding < 0, 0, thisclose);
end
以下是引用fly在2013-5-15 17:08:01的发言:
//“固定时间间隔”轮询模式,1分钟周期
if DYNAINFO(207)>151338 and islastbar then begin
sell(holding > 0, 0, thisclose);
sellshort(holding < 0, 0, thisclose);
end
if time > 151400 and not(islastbar) then begin
sell(holding > 0, 0, thisclose);
sellshort(holding < 0, 0, thisclose);
end
请教:
这是两种不同的代码表达方式还是结合起来才能达到尾盘平仓的要求?
请教老师:
您提供的这两种不同的代码表达方式还是结合起来才能达到尾盘平仓的要求?