以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  [原创]后台头寸矫正程序  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=2938)

--  作者:ch3coohqb
--  发布时间:2010/9/21 13:51:37
--  [推荐]写日内策略时少用全平语句

后台头寸矫正程序

 

tsell(holding=0 and tholding>0,tholding,lmt,l-mindiff*2),ALLOWREPEAT;
tsellshort(holding=0 and tholding<0,tholding,lmt,h+mindiff*2),ALLOWREPEAT;
tbuy(holding>tholding and tholding>=0,holding-tholding,lmt,h+mindiff*2),ALLOWREPEAT;
tbuyshort(holding<tholding and tholding<=0,tholding-holding,lmt,l-mindiff*2),ALLOWREPEAT;

 

debugout(\'当前实际持仓%.0f\',tholding);
debugout(\'当前图表持仓%.0f\',holding);
debugout(\'开仓历时%.0f\',tenterbars);
debugfile(\'d:\\test.txt\',\'当前持仓%.2f\',tholding);
================

 

有时候做图表交易的时候会有部分交易指令没发出(不是没成交或者指令被拒而是没发出)~

目前暂时搞不清是用户自身操作问题还是CTP模拟服务器的问题还是软件问题

解决办法是开个后台头寸矫正程序

保持帐户中真实持仓与图表一致~

0秒确认的程序

非常同步..

 

 


--  作者:wattwei
--  发布时间:2010/9/21 14:06:44
--  
好,有创造力。谢谢分享,论坛因你精彩
--  作者:ch3coohqb
--  发布时间:2010/9/21 14:15:42
--  
开仓好像有点问题~平仓没问题...
--  作者:msedu
--  发布时间:2010/9/21 14:33:06
--  

不错,这是我一贯的做法,这样做,科学不科学,尚且需要大家进一步探讨。。


--  作者:newbasic
--  发布时间:2010/9/30 12:33:58
--  
谢谢你
--  作者:newbasic
--  发布时间:2010/9/30 21:18:50
--  

不知道什么原因,开的仓很快被后台平掉了


--  作者:newbasic
--  发布时间:2010/9/30 21:20:06
--  
能在语句后面做些注释吗
--  作者:newbasic
--  发布时间:2010/10/8 13:02:27
--  

不知道什么原因,开的仓很快被后台平掉了

 设置时间间隔0秒
--  作者:fly
--  发布时间:2010/10/8 13:27:29
--  
你用的是公用测试帐号吧,要是,就是别人给你平掉了
--  作者:solarhe2006
--  发布时间:2012/7/23 13:24:03
--  

后台头寸矫正程序

 

tsell(holding=0 and tholding>0,tholding,lmt,l-mindiff*2),ALLOWREPEAT;
tsellshort(holding=0 and tholding<0,tholding,lmt,h+mindiff*2),ALLOWREPEAT;
tbuy(holding>tholding and tholding>=0,holding-tholding,lmt,h+mindiff*2),ALLOWREPEAT;
tbuyshort(holding<tholding and tholding<=0,tholding-holding,lmt,l-mindiff*2),ALLOWREPEAT;

 

debugout(\'当前实际持仓%.0f\',tholding);
debugout(\'当前图表持仓%.0f\',holding);
debugout(\'开仓历时%.0f\',tenterbars);
debugfile(\'d:\\test.txt\',\'当前持仓%.2f\',tholding);
================

 

有时候做图表交易的时候会有部分交易指令没发出(不是没成交或者指令被拒而是没发出)~

目前暂时搞不清是用户自身操作问题还是CTP模拟服务器的问题还是软件问题

解决办法是开个后台头寸矫正程序

保持帐户中真实持仓与图表一致~

0秒确认的程序