以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  金字塔软件问题提交  (http://weistock.com/bbs/list.asp?boardid=2)
----  持仓控制似乎总有问题  (http://weistock.com/bbs/dispbbs.asp?boardid=2&id=56598)

--  作者:leonxu
--  发布时间:2013/9/13 9:57:58
--  持仓控制似乎总有问题
似乎金字塔对多策略的持仓控制总无法精确,特别是多策略时,有时单策略,也会不按要求下单,明明是只要求下一手单的,结果在对账单上就可以看到下了2手,即使是单策略也出现这样的问题,说明金字塔对tholding=0这个条件查询反应是不准确的。
--  作者:王锋
--  发布时间:2013/9/13 10:06:35
--  

后台在非走完K线模式下,tholding=0 这样的条件是非常危险的。

具体请参考 http://www.weistock.com/bbs/dispbbs.asp?boardid=16&Id=332 问题15.

 

解决方案是 tholding=0 时还要加以判断是否有未成交的委托单,请参考 http://www.weistock.com:8080/vip/forum.php?mod=viewthread&tid=289&extra=page%3D1 这里的部分范例代码


--  作者:leonxu
--  发布时间:2013/9/13 10:36:33
--  
怎么弄, 其实是用tholdng2=0来控制的
--  作者:王锋
--  发布时间:2013/9/13 10:43:16
--  
好好看看给你回复的帖子
--  作者:lichenghu
--  发布时间:2013/9/13 10:44:21
--  

道理上是一样的,就是对未成交单的一个判断


--  作者:leonxu
--  发布时间:2013/9/13 13:35:30
--  

if tholding2=0 and TREMAINQTY(1,\'\',\'\')=0 and TREMAINQTY(3,\'\',\'\')=0 then extgbdataset(\'orderdone\',0);

if (TREMAINQTY(1,\'\',\'\')>0 or TREMAINQTY(3,\'\',\'\')>0) and tholding2=0 then extgbdataset(\'orderdone\',1);
if abs(tholding2)>0 and not(extgbdata(\'orderdone\')=3)  then  extgbdataset(\'orderdone\',2);

 

 

 if sellcondZB and tbuyholding(1)>0 then begin
  tcancel(1,2);tcancel(1,4);
  平多ZB1:tsell(1,tbuyholding(1),mkt);
  if Islastbar then DEBUGFILE2(\'D:\\NTGAN.TXT\',\'  sellcondZB:\'&numtostr(sellcondZB,0)&\'  tholding2=\'&numtostr(tholding2,0)&\'  开多:\'&numtostr(TREMAINQTY(1,\'\',\'\'),0)&\'  开空:\'&numtostr(TREMAINQTY(3,\'\',\'\'),0)&\'  orderdorderdone\'),1);
  sleep(m);
  if tholding2=0 and TREMAINQTY(1,\'\',\'\')=0 and TREMAINQTY(3,\'\',\'\')=0 then extgbdataset(\'orderdone\',0);
 end
 
 if  buyshortcondZB0 then begin
  tcancel(1,3);tcancel(1,1);
  if TREMAINQTY(1,\'\',\'\')=0 and TREMAINQTY(3,\'\',\'\')=0 and tholding2=0 then begin
   开空ZB0:tbuyshort(1,1,mkt);
   if Islastbar then DEBUGFILE2(\'D:\\NTGAN.TXT\',\'  buyshortcondZB0:\'&numtostr(buyshortcondZB0,0)&\'  tholding2=\'&numtostr(tholding2,0)&\'  开多:\'&numtostr(TREMAINQTY(1,\'\',\'\'),0)&\'  开空:\'&numtostr(TREMAINQTY(3,\'\',\'\'),0)&\'  orderdorderdone\'),1);
   sleep(n);
   if (TREMAINQTY(1,\'\',\'\')>0 or TREMAINQTY(3,\'\',\'\')>0) and tholding2=0 then extgbdataset(\'orderdone\',1);
   if abs(tholding2)>0 and extgbdata(\'orderdone\')=1 then  extgbdataset(\'orderdone\',2);
  end
 end
 
 if sellshortcondZB and tsellholding(1)>0 then begin
  tcancel(1,2);tcancel(1,4);
  平空ZB1:tsellshort(1,tsellholding(1),mkt);
  if Islastbar then DEBUGFILE2(\'D:\\NTGAN.TXT\',\'  sellshortcondZB:\'&numtostr(sellshortcondZB,0)&\'  tholding2=\'&numtostr(tholding2,0)&\'  开多:\'&numtostr(TREMAINQTY(1,\'\',\'\'),0)&\'  开空:\'&numtostr(TREMAINQTY(3,\'\',\'\'),0)&\'  orderdorderdone\'),1);
  sleep(m);
  if tholding2=0 and TREMAINQTY(1,\'\',\'\')=0 and TREMAINQTY(3,\'\',\'\')=0 then extgbdataset(\'orderdone\',0);
 end
 
 if  buycondZB0 then begin
  tcancel(1,3);tcancel(1,1);
  if TREMAINQTY(1,\'\',\'\')=0 and TREMAINQTY(3,\'\',\'\')=0 and tholding2=0 then begin
   开多ZB0:tbuy(1,1,mkt);
   if Islastbar then DEBUGFILE2(\'D:\\NTGAN.TXT\',\'  buycondZB0:\'&numtostr(buycondZB0,0)&\'  tholding2=\'&numtostr(tholding2,0)&\'  开多:\'&numtostr(TREMAINQTY(1,\'\',\'\'),0)&\'  开空:\'&numtostr(TREMAINQTY(3,\'\',\'\'),0)&\'  orderdorderdone\'),1);
   sleep(n);
   if (TREMAINQTY(1,\'\',\'\')>0 or TREMAINQTY(3,\'\',\'\')>0) and tholding2=0 then extgbdataset(\'orderdone\',1);
   if abs(tholding2)>0 and extgbdata(\'orderdone\')=1 then  extgbdataset(\'orderdone\',2);
  end
 end


--  作者:leonxu
--  发布时间:2013/9/13 13:36:17
--  

其实都有做控制的,但还是不行,我是每秒固定轮询的


--  作者:leonxu
--  发布时间:2013/9/13 13:38:30
--  
我还怕是轮询时间太短了,所以交易动作元老最让它停一会
--  作者:leonxu
--  发布时间:2013/9/13 13:39:02
--  
所以交易动作完都让它停一会
--  作者:lichenghu
--  发布时间:2013/9/13 13:47:41
--  

N您好,勾下交易日志看下

[此贴子已经被作者于2013/9/13 13:48:32编辑过]