欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件公式模型编写问题提交 → 日内后台多账户中某一个账户满仓反手

   

欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。    


  共有4044人关注过本帖树形打印复制链接

主题:日内后台多账户中某一个账户满仓反手

帅哥哟,离线,有人找我吗?
弦外之音
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:新手上路 帖子:67 积分:431 威望:0 精华:0 注册:2010/10/12 9:26:32
日内后台多账户中某一个账户满仓反手  发帖心情 Post By:2011/12/30 9:54:50    Post IP:120.36.175.41[只看该作者]

如题,后台多账户中,某一个账户有不同的交易策略组合,总仓位满仓,当所有的模型都开仓后,怎么解决其中某一个模型反手时保证金不足无法开仓的问题?


 回到顶部
帅哥哟,离线,有人找我吗?
fly
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:5082 积分:17642 威望:0 精华:6 注册:2010/7/15 9:05:58
  发帖心情 Post By:2011/12/30 10:12:45    Post IP:58.246.57.26[只看该作者]

平仓反手,又担心反手时保证金不足,无法开仓.

用ORDERQUEUE,结合多少秒不成交就撤单.



金字塔—专业程序化交易量化投资平台

客户服务部

-----------------------------------------------------------

欢迎您参加我公司的技术培训,具体培训需求请发邮件到

service@weistock.com

您的宝贵建议或者投诉,请发往邮箱:weiwei@weistock.com

 回到顶部
帅哥哟,离线,有人找我吗?
弦外之音
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:新手上路 帖子:67 积分:431 威望:0 精华:0 注册:2010/10/12 9:26:32
  发帖心情 Post By:2011/12/30 10:16:25    Post IP:120.36.175.41[只看该作者]

以下是引用fly在2011-12-30 10:12:45的发言:

平仓反手,又担心反手时保证金不足,无法开仓.

用ORDERQUEUE,结合多少秒不成交就撤单.

在指定满仓账户的开仓条件里面加入abb:

abb:=not(islastbar) or (islastbar and tholding2=0);

是否可行?


 回到顶部
帅哥哟,离线,有人找我吗?
弦外之音
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:新手上路 帖子:67 积分:431 威望:0 精华:0 注册:2010/10/12 9:26:32
  发帖心情 Post By:2011/12/30 10:24:31    Post IP:120.36.175.41[只看该作者]

buycond:=ref(c>ma(c,5),1);
sellcond:=ref(c<ma(c,5),1);
nn:=barslast(date<>ref(date,1))+1;
entertime:=time>=91500 and time<143000;
exittime:=time>150000;
abb:=not(islastbar) or (islastbar and tholding2=0);
if holding>0 and sellcond then begin
 sell(1,1,limitr,o-1);
 tsell(abb,1,lmt,o-1,0,'801019');
 tsell(1,3,lmt,o-1,0,'800435');
end
if holding<0 and buycond then begin
 sellshort(1,1,limitr,o+1);
 tsellshort(abb,1,lmt,o+1,0,'801019');
 tsellshort(1,3,lmt,o+1,0,'800435');
end
if holding=0 and buycond and abb then begin
 buy(1,1,limitr,o+1);
 tbuy(abb,1,lmt,o+1,0,'801019');
 tbuy(abb,3,lmt,o+1,0,'800435');
end
if holding=0 and sellcond and abb then begin
 buyshort(1,1,limitr,o-1);
 tbuyshort(abb,1,lmt,o-1,0,'801019');
 tbuyshort(abb,3,lmt,o-1,0,'800435');
end

以上代码在模拟交易的时候运行正常。请问是否存在问题?


 回到顶部
帅哥哟,离线,有人找我吗?
fly
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:5082 积分:17642 威望:0 精华:6 注册:2010/7/15 9:05:58
  发帖心情 Post By:2011/12/30 10:26:12    Post IP:58.246.57.26[只看该作者]

不行,

tholding2会返回该帐户的所有实际持仓的,而不是该帐户该策略的实际持仓.

你是不同策略,又是满仓

 

 



金字塔—专业程序化交易量化投资平台

客户服务部

-----------------------------------------------------------

欢迎您参加我公司的技术培训,具体培训需求请发邮件到

service@weistock.com

您的宝贵建议或者投诉,请发往邮箱:weiwei@weistock.com

 回到顶部
帅哥哟,离线,有人找我吗?
弦外之音
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:新手上路 帖子:67 积分:431 威望:0 精华:0 注册:2010/10/12 9:26:32
  发帖心情 Post By:2011/12/30 10:45:31    Post IP:120.36.175.41[只看该作者]

buycond:=ref(c>ma(c,5),1);
sellcond:=ref(c<ma(c,5),1);
nn:=barslast(date<>ref(date,1))+1;
entertime:=time>=91500 and time<143000;
exittime:=time>150000;
abb:=not(islastbar);
if holding>0 and (sellcond or exittime) then begin
  sell(1,1,limitr,o-1);
  tsell(1,1,lmt,o-1,0,'800435');
end

if holding<0 and (buycond or exittime) then begin
  sellshort(1,1,limitr,o+1);
  tsellshort(1,1,lmt,o+1,0,'800435');
end

if holding=0 and entertime and buycond then begin
  buy(abb or tbuyholding(1)>0,1,limitr,o+1);
  tbuy(abb or tbuyholding(1)>0,1,lmt,o+1,0,'800435');
end

if holding=0 and entertime and sellcond then begin
  buyshort(abb or tsellholding(1)>0,1,limitr,o-1);
  tbuyshort(abb or tsellholding(1)>0,1,lmt,o-1,0,'800435');
end

这么写可以吗?


 回到顶部
帅哥哟,离线,有人找我吗?
fly
  7楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:5082 积分:17642 威望:0 精华:6 注册:2010/7/15 9:05:58
  发帖心情 Post By:2011/12/30 14:33:19    Post IP:58.246.57.26[只看该作者]

不行

tsellholding(1)当前品种当前帐户空头持仓(而不一定是您写的800435这个帐户)

tbuyholding(1)当前品种当前帐户多头持仓

 

如果你的策略已经复杂了,就转成纯后台的执行吧,漫漫学着跟踪调试吧

http://www.weistock.com/bbs/dispbbs.asp?boardid=4&id=1246&page=1&star=1

 



金字塔—专业程序化交易量化投资平台

客户服务部

-----------------------------------------------------------

欢迎您参加我公司的技术培训,具体培训需求请发邮件到

service@weistock.com

您的宝贵建议或者投诉,请发往邮箱:weiwei@weistock.com

 回到顶部