-- 作者:zealot123
-- 发布时间:2011/8/2 22:28:50
-- 又是有信号没委托的问题
这次是收盘平仓,这个问题出现频率还比较高。
1秒固定轮询,
下单设置:20秒不成交主动撤单。未成交10秒后在5个变动价范围内主动追单,否则就主动撤单(勾选:市价追单)
公式:
If currenttime>1455 and TISREMAIN(0)=0 AND TRADECOND=1 then begin Extgbdataset (\'Cfclosetimecon\', extgbdata(\'Cfclosetimecon\')+1);
if extgbdata(\'Cfclosetimecon\')>=3 then begin DEBUGFILE(\'D:\\TEST.TXT\', \' Cfclosetimecon %.2f\', extgbdata(\'Cfclosetimecon\')); //确认三次,则开始收盘平仓,同时在调试中做出记录。
if (Tholding>0 or ttype(1)=1) then begin tsell(1,0,mkt ) ,ORDERQUEUE; Extgbdataset(\'CFtimecloseSell\',1) ; DEBUGFILE(\'D:\\TEST.TXT\', \' CFtimecloseSell %.2f\', extgbdata(\' CFtimecloseSell \')); //平多,并记录。 SLEEP(1000); End;
if (Tholding<0 or ttype(1)=3) then begin tsellshort(1,0,mkt ) ,ORDERQUEUE; Extgbdataset(\'CFtimecloseSellShort\',1) ; DEBUGFILE(\'D:\\TEST.TXT\', \' CFtimecloseSellShort %.2f\', extgbdata(\' CFtimecloseSellShort \')); //平空,并记录 SLEEP(1000); End;
extgbdataset(\'CFbuySL\',0); extgbdataset(\'CFsellSL\',1000000); end;
end; else Extgbdataset (\'Cfclosetimecon\', 0);
调试记录:
2011-08-02 14:54:59.876 currenttime 145459.00 2011-08-02 14:54:59.876 time 145500.00 2011-08-02 14:54:59.876 tholding -6.00 2011-08-02 14:54:59.876 ttype(3) 3.00 2011-08-02 14:54:59.876 ttype(2) 4.00 2011-08-02 14:54:59.876 ttype(1) 3.00 2011-08-02 14:54:59.876 tenterbars(1) 8.00 2011-08-02 14:54:59.876 TISREMAIN(0) 0.00 2011-08-02 14:55:00.905 ------------------------------------------------- 111.00 2011-08-02 14:55:00.905 currenttime 145500.00 2011-08-02 14:55:00.905 time 145500.00 2011-08-02 14:55:00.905 tholding -6.00 2011-08-02 14:55:00.905 ttype(3) 3.00 2011-08-02 14:55:00.905 ttype(2) 4.00 2011-08-02 14:55:00.905 ttype(1) 3.00 2011-08-02 14:55:00.905 tenterbars(1) 8.00 2011-08-02 14:55:00.905 TISREMAIN(0) 0.00 2011-08-02 14:55:01.888 ------------------------------------------------- 111.00 2011-08-02 14:55:01.888 currenttime 145501.00 2011-08-02 14:55:01.888 time 145500.00 2011-08-02 14:55:01.888 tholding -6.00 2011-08-02 14:55:01.888 ttype(3) 3.00 2011-08-02 14:55:01.888 ttype(2) 4.00 2011-08-02 14:55:01.888 ttype(1) 3.00 2011-08-02 14:55:01.888 tenterbars(1) 8.00 2011-08-02 14:55:01.888 TISREMAIN(0) 0.00 2011-08-02 14:55:02.902 ------------------------------------------------- 111.00 2011-08-02 14:55:02.902 currenttime 145502.00 2011-08-02 14:55:02.902 time 145500.00 2011-08-02 14:55:02.902 tholding -6.00 2011-08-02 14:55:02.902 ttype(3) 3.00 2011-08-02 14:55:02.902 ttype(2) 4.00 2011-08-02 14:55:02.902 ttype(1) 3.00 2011-08-02 14:55:02.902 tenterbars(1) 8.00 2011-08-02 14:55:02.902 TISREMAIN(0) 0.00 2011-08-02 14:55:03.916 Cfclosetimecon 3.00 2011-08-02 14:55:03.916 CFtimecloseSellShort 0.00 2011-08-02 14:55:04.930 ------------------------------------------------- 111.00 2011-08-02 14:55:04.930 currenttime 145504.00 2011-08-02 14:55:04.930 time 145500.00 2011-08-02 14:55:04.930 tholding -6.00 2011-08-02 14:55:04.930 ttype(3) 3.00 2011-08-02 14:55:04.930 ttype(2) 4.00 2011-08-02 14:55:04.930 ttype(1) 3.00 2011-08-02 14:55:04.930 tenterbars(1) 8.00 2011-08-02 14:55:04.930 TISREMAIN(0) 0.00 2011-08-02 14:55:05.975 Cfclosetimecon 4.00 2011-08-02 14:55:05.975 CFtimecloseSellShort 0.00 2011-08-02 14:55:06.989 ------------------------------------------------- 111.00 2011-08-02 14:55:06.989 currenttime 145506.00 2011-08-02 14:55:06.989 time 150000.00 2011-08-02 14:55:06.989 tholding -6.00 2011-08-02 14:55:06.989 ttype(3) 3.00 2011-08-02 14:55:06.989 ttype(2) 4.00 2011-08-02 14:55:06.989 ttype(1) 3.00 2011-08-02 14:55:06.989 tenterbars(1) 8.00 2011-08-02 14:55:06.989 TISREMAIN(0) 0.00 2011-08-02 14:55:08.019 Cfclosetimecon 5.00 2011-08-02 14:55:08.019 CFtimecloseSellShort 0.00
一直没有成功平仓,直到通过止损设置的强制收盘时间平仓。
orderlog:
2011-08-02 14:54:58.846 【后台】CF00 运行结束 2011-08-02 14:54:59.876 【后台】CF00 运行结束 2011-08-02 14:55:00.905 【后台】CF00 运行结束 2011-08-02 14:55:01.888 【后台】CF00 运行结束 2011-08-02 14:55:02.918 【后台】CF00 运行结束 2011-08-02 14:55:04.930 【后台】CF00 运行结束 2011-08-02 14:55:06.989 【后台】CF00 运行结束 2011-08-02 14:55:09.049 【后台】CF00 运行结束 2011-08-02 14:55:11.014 【后台】CF00 运行结束 2011-08-02 14:55:13.042 【后台】CF00 运行结束 2011-08-02 14:55:15.055 【后台】CF00 运行结束
。。。。
2011-08-02 14:55:57.764 【后台】CF00 运行结束 2011-08-02 14:55:59.739 【后台】CF00 运行结束 2011-08-02 14:56:01.689 【下单】CF01 价21370.000000 量6 买卖0 类型1 开平1 账户84020437 Formula 1 2011-08-02 14:56:01.689 【风控】到达收盘前强平时间 2011-08-02 14:56:01.798 【后台】CF00 运行结束 2011-08-02 14:56:01.798 【回报】84020437 : CF201 - 已报单 6 价格:0 平 买 2011-08-02 14:56:02.287 【回报】84020437 : CF201 - 已成交 6 价格:21370 平 买
经过自查,也不是因为http://www.weistock.com/bbs/dispbbs.asp?boardid=4&Id=332
中第13项的原因。
请帮忙看看,
谢谢!!
|