减少同时间下单的量, 当信号出来后,控制固定的时间,比如30后,根据信号下单,应该如何写
八、提前N秒下单的方法,适用于各个周期
//这里以股指期货为例,商品原理类似:关键是找出K线结束的时间规律。
大家注意了
2.80版本以上,time这个函数有所变化,直接可以直接获得K线结束的时间。提前下单更加方便了
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);
是不是这里的小于改成大于tq就可以了
感觉永远不会大于这时间 time0-timetot0(dynainfo(207)都是<的
看你这个例子,看不懂啊,能不能用
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);
来举例
不行,这个是用的提前下单,不是延迟下单
你这个必须用上面的例子出现信号记录时间,然后控制。因为本身就属于需要一定编程技巧的使用