请问固定轮询的是怎样计算的?如果我是15分钟周期的模型,想实现60秒下单,我设置840秒的间隔,是不是在出现信号的时候可以实现提前60秒下单哪?谢谢
你理解的有点偏差。固定时间间隔,是间隔相同时间检测信号是否触发。
你是想提前60秒下单。可以考虑使用软件中带的走完k提前n秒下单(专业版功能)
或者在策略中用代码实现。
input:tq(5,3,60,1);//TQ即为您要提前的秒数
abb:=(time0-timetot0(dynainfo(207))<=tq) or not(islastbar);
请教老师;论坛上的阿火秘籍中的提前下单方法是否可以实现?
ma5:=ma(c,5);
ma10:=ma(c,10);
input:tq(5,3,60,1);
abb:=(time0-timetot0(dynainfo(207))<=tq) or not(islastbar);
if abb then begin
if holding>0 and ma5<ma10 then sell(1,1,thisclose);
if holding<0 and ma5>ma10 then sellshort(1,1,thisclose);
if holding=0 and ma5>ma10 then buy(1,1,thisclose);
if holding=0 and ma5<ma10 then buyshort(1,1,thisclose);
end
请老师指点;我是15分钟周期,要提前10秒下单,每次开仓5手,abb:=(time0-timetot0(dynainfo(207))<=10) or not(islastbar);
if abb then begin
if holding>0 and ma5<ma10 then sell(1,1,thisclose);
if holding<0 and ma5>ma10 then sellshort(1,1,thisclose);
if holding=0 and ma5>ma10 then buy(1,5,thisclose);
if holding=0 and ma5<ma10 then buyshort(1,5,thisclose);
end
谢谢
开平仓顺序写成
abb:=(time0-timetot0(dynainfo(207))<=10) or not(islastbar);
if abb then begin
if holding<0 and ma5>ma10 then sellshort(1,1,thisclose);
if holding=0 and ma5>ma10 then buy(1,5,thisclose);
if holding>0 and ma5<ma10 then sell(1,1,thisclose);
if holding=0 and ma5<ma10 then buyshort(1,5,thisclose);
end
如果我有多个平多,平空。开多,开空这样编写对吗?谢谢老师!
abb:=(time0-timetot0(dynainfo(207))<=10) or not(islastbar);
if abb then begin
if holding<0 and ma5>ma10 then sellshort(1,1,thisclose);
if holding<0 and ma5>ma10 then sellshort(1,1,thisclose);
if holding<0 and ma5>ma10 then sellshort(1,1,thisclose);
if holding=0 and ma5>ma10 then buy(1,5,thisclose);
if holding=0 and ma5>ma10 then buy(1,5,thisclose);
if holding>0 and ma5<ma10 then sell(1,1,thisclose);
if holding>0 and ma5<ma10 then sell(1,1,thisclose);
if holding>0 and ma5<ma10 then sell(1,1,thisclose);
if holding=0 and ma5<ma10 then buyshort(1,5,thisclose);
if holding=0 and ma5<ma10 then buyshort(1,5,thisclose);
end
不理解你的代码意图?你是想相同条件中,开多次?还是什么?