以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  如何延后发单呢?  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=68638)

--  作者:ivan
--  发布时间:2014/8/12 14:49:31
--  如何延后发单呢?
后台程序,由于用轮询方式提前几秒下单,可能在某个时候会出现信号闪烁,而造成频繁的下单(allowrepeat),怎么样才能通过限制的方式减少反复下单呢?

比如提前5秒下单,延后3秒才判断信号是否消失,代码该如何写呢?



--  作者:jinzhe
--  发布时间:2014/8/12 14:50:49
--  

http://www.weistock.com/bbs/dispbbs.asp?BoardID=4&ID=2183&skin=0

信号延时参考这贴里面ADMIN的回答


--  作者:Ivan
--  发布时间:2014/8/12 15:13:54
--  
我要的是同向开仓的间隔超过N秒,如何表达呢?
--  作者:jinzhe
--  发布时间:2014/8/12 15:32:23
--  

我简化了一下,根据我的理解来的

if 开多条件 and 持仓判断 and timetot0(currenttime)-timetot0(extgbdata(\'time1\'))>n then begin

    tbuy....;

    extgbdataset(\'time1\',currenttime);

end

 

 


--  作者:Ivan
--  发布时间:2014/8/12 15:46:48
--  
谢谢!我是单策略多周期交易,最好不用用数据库全局变量,用全局变量不行吗?

if 开多条件 and 持仓判断 and timetot0(currenttime)-timetot0(\'time1)>n then begin

    tbuy....;

    time1:=currenttime;

end


if time>=151458 then time1:=0;


这样不行吗?


--  作者:jinzhe
--  发布时间:2014/8/12 15:54:26
--  
也可以不过不管哪种写法,每天重置全局变量为0
--  作者:Ivan
--  发布时间:2014/8/12 16:03:53
--  
我在收盘时已做了重置为0:


if 开多条件 and 持仓判断 and timetot0(currenttime)-timetot0(\'time1)>n then begin

    tbuy....;

    time1:=currenttime;

end


if time>=151458 then time1:=0;


这样可以吧?


--  作者:jinzhe
--  发布时间:2014/8/12 16:12:12
--  
可以
--  作者:pyd
--  发布时间:2014/8/12 16:19:47
--  
加上一个超全局变量的定义

--  作者:风水财神
--  发布时间:2014/8/13 16:59:02
--  
请问 

我简化了一下,根据我的理解来的

if 开多条件 and 持仓判断 and timetot0(currenttime)-timetot0(extgbdata(\'time1\'))>n then begin

    tbuy....;

    extgbdataset(\'time1\',currenttime);

end


time1 不用设定初始值吗 就直接这样用吗