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


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

   

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


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

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

帅哥哟,离线,有人找我吗?
弦外之音
  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[显示全部帖子]

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


 回到顶部
帅哥哟,离线,有人找我吗?
弦外之音
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | 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);

是否可行?


 回到顶部
帅哥哟,离线,有人找我吗?
弦外之音
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | 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

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


 回到顶部
帅哥哟,离线,有人找我吗?
弦外之音
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | 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

这么写可以吗?


 回到顶部