教程上说图表交易尽量不要用返回常数而非序列数据的CURRENTTIME
如果1分钟周期,在一根K线收盘前3秒开仓,是否只能用CURRENTTIME完成,应该怎么写呢,容易出错吗
CURRENTIME返回当前本地时间,本地时间对应有时候可能会有误差
K线提前3s下单 M1:TIME0-TIMETOT0(DYNAINFO(207))//M1表示K线走完还要多少s
IF M1<=3 AND 平仓条件 THEN
SELL()
CURRENTIME返回当前本地时间,本地时间对应有时候可能会有误差
K线提前3s下单 M1:TIME0-TIMETOT0(DYNAINFO(207))//M1表示K线走完还要多少s
IF M1<=3 AND 平仓条件 THEN
SELL()
明白了,谢谢
选用:固定时间间隔
input:tq(3,3,60,1);
ma5:=ma(c,5);
ma10:=ma(c,10);
abb:=(time0-timetot0(dynainfo(207))<=tq) or not(islastbar); //一根K线收盘前3秒开平仓
//平空开多
if cross(ma5,ma10) and abb then begin
sellshort(holding<0,1,thisclose);
buy(holding=0,1,thisclose);
end
//平多开空
if cross(ma10,ma5) and abb then begin
sell(1,1,thisclose);
buyshort(1,1,thisclose);
end
选用:固定时间间隔
abb:=(time0-timetot0(dynainfo(207))<=tq) or not(islastbar); //一根K线收盘前3秒开平仓
加了一个“or not(islastbar)” ,实际效果是更好吗?