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


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件金字塔软件问题提交 → 金字塔能不能把3个模型股指的多、空持仓相抵后再下单

   

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


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

主题:金字塔能不能把3个模型股指的多、空持仓相抵后再下单

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


加好友 发短信
等级:论坛游侠 帖子:231 积分:55 威望:0 精华:0 注册:2013/2/7 14:30:23
金字塔能不能把3个模型股指的多、空持仓相抵后再下单  发帖心情 Post By:2015/2/10 14:20:46 [只看该作者]

老师好

国内期货交易中,比如股指,我用3个模型同时在一个框架下跟踪主力合约,金字塔能不能把3个模型股指的多、空持仓相抵后再下单,而不是分别多空互持?

谢谢

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


加好友 发短信
等级:黑侠 帖子:723 积分:355 威望:0 精华:0 注册:2011/1/25 9:58:24
  发帖心情 Post By:2015/2/10 14:28:11 [只看该作者]

这个我有办法,我做过同类的策略

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


加好友 发短信
等级:超级版主 帖子:5960 积分:0 威望:0 精华:2 注册:2014/6/12 11:29:04
  发帖心情 Post By:2015/2/10 14:37:11 [只看该作者]

同一品种和周期?那你直接使用STKINDI引用2个策略的HOLDING ,然后想减实现下单呗



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

产品部

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

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

您的宝贵建议或者投诉,请发往邮箱:weiwei@weistock.com
 回到顶部
帅哥哟,离线,有人找我吗?
tsycd
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:论坛游侠 帖子:231 积分:55 威望:0 精华:0 注册:2013/2/7 14:30:23
  发帖心情 Post By:2015/2/10 14:54:19 [只看该作者]

同一品种,但是不同周期

具体程序怎么写?

谢谢

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


加好友 发短信
等级:黑侠 帖子:723 积分:355 威望:0 精华:0 注册:2011/1/25 9:58:24
  发帖心情 Post By:2015/2/10 15:01:25 [只看该作者]

检查各策略,如果之前持有反向仓,则当前策略要开另一个方向仓,则当做平反向仓的指令发出,如果之前没有或者有同向单子,则不予理会照开

版主评定:好评,获得3个金币奖励好评,获得3个金币奖励
(理由:方案也可行)
 回到顶部
帅哥哟,离线,有人找我吗?
qwer123
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:小飞侠 帖子:1966 积分:0 威望:0 精华:1 注册:2013/6/15 21:56:35
  发帖心情 Post By:2015/2/10 15:32:09 [只看该作者]

//股指期货自动交易程序(净单交易)
//编制
//日期:

r1:=barslast(date<>ref(date,1));
//********************************
rr1:=stkindiex('if00','qq25.持仓',0,22,65,400);
rr2:=stkindiex('if00','qq25.持仓',0,22,80,400);
rr3:=stkindiex('if00','qq25.持仓',0,22,85,400);
rr4:=stkindiex('if00','qq25.持仓',0,22,90,400);
rr5:=stkindiex('if00','qq25.持仓',0,22,115,400);
rr6:=stkindiex('if00','qq25.持仓',0,22,125,400);
rr7:=stkindiex('if00','qq25.持仓',0,22,185,400);

r12:=rr1+rr2+rr3+rr4+rr5+rr6+rr7;

//***************第一遍***************
if holding=0 and r12>0 then buy(1,r12,limitr,c);
if holding=0 and r12<0 then buyshort(1,abs(r12),limitr,c);

if holding>0 and r12>0 and holding>r12 then sell(1,holding-r12,limitr,c);
if holding>0 and r12>0 and holding<r12 then buy(1,r12-holding,limitr,c);
if holding>0 and r12<0 then
begin
sell(1,holding,limitr,c);
buyshort(1,abs(r12),limitr,c);
end
if holding<0 and r12<0 and holding>r12 then buyshort(1,holding-r12,limitr,c);
if holding<0 and r12<0 and holding<r12 then sellshort(1,r12-holding,limitr,c);
if holding<0 and r12>0 then
begin
sellshort(1,holding,limitr,c);
buy(1,r12,limitr,c);
end 
if r12=0 and holding>0 then sell(holding>0,holding,limitr,c);
if r12=0 and holding<0 then sellshort(holding<0,abs(holding),limitr,c);

//***************第2遍***************
if holding=0 and r12>0 then buy(1,r12,limitr,c);
if holding=0 and r12<0 then buyshort(1,abs(r12),limitr,c);

if holding>0 and r12>0 and holding>r12 then sell(1,holding-r12,limitr,c);
if holding>0 and r12>0 and holding<r12 then buy(1,r12-holding,limitr,c);
if holding>0 and r12<0 then
begin
sell(1,holding,limitr,c);
buyshort(1,abs(r12),limitr,c);
end
if holding<0 and r12<0 and holding>r12 then buyshort(1,holding-r12,limitr,c);
if holding<0 and r12<0 and holding<r12 then sellshort(1,r12-holding,limitr,c);
if holding<0 and r12>0 then
begin
sellshort(1,holding,limitr,c);
buy(1,r12,limitr,c);
end 
if r12=0 and holding>0 then sell(holding>0,holding,limitr,c);
if r12=0 and holding<0 then sellshort(holding<0,abs(holding),limitr,c);
//***************第3遍***************
if holding=0 and r12>0 then buy(1,r12,limitr,c);
if holding=0 and r12<0 then buyshort(1,abs(r12),limitr,c);

if holding>0 and r12>0 and holding>r12 then sell(1,holding-r12,limitr,c);
if holding>0 and r12>0 and holding<r12 then buy(1,r12-holding,limitr,c);
if holding>0 and r12<0 then
begin
sell(1,holding,limitr,c);
buyshort(1,abs(r12),limitr,c);
end
if holding<0 and r12<0 and holding>r12 then buyshort(1,holding-r12,limitr,c);
if holding<0 and r12<0 and holding<r12 then sellshort(1,r12-holding,limitr,c);
if holding<0 and r12>0 then
begin
sellshort(1,holding,limitr,c);
buy(1,r12,limitr,c);
end 
if r12=0 and holding>0 then sell(holding>0,holding,limitr,c);
if r12=0 and holding<0 then sellshort(holding<0,abs(holding),limitr,c);
//********************************
盈亏:asset-1000000,colorred,linethick1,noaxis;
日盈亏:asset-ref(asset,todaybar),noaxis,colorred,linethick0;
持仓:holding,linethick0;


注意:1.信号不要闪,否则会来回交易;
        2.最好是用专业版tbuy,tsell.....;
        3.如果是标准版引用了3个程序的holding,最好是执行3遍。
[此贴子已经被作者于2015/2/10 15:33:25编辑过]

版主评定:好评,获得8个金币奖励好评,获得8个金币奖励
(理由:完美实例)
 回到顶部
帅哥哟,离线,有人找我吗?
tsycd
  7楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:论坛游侠 帖子:231 积分:55 威望:0 精华:0 注册:2013/2/7 14:30:23
  发帖心情 Post By:2015/2/10 16:13:52 [只看该作者]

非常感谢!


 回到顶部