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


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件程序化交易实盘俱乐部 → [分享]打破股指交易限制

   

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


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

主题:[分享]打破股指交易限制

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


加好友 发短信
等级:小飞侠 帖子:1966 积分:0 威望:0 精华:1 注册:2013/6/15 21:56:35
[分享]打破股指交易限制  发帖心情 Post By:2016/4/2 14:12:14 [只看该作者]

股指交易限制让人很无语。现在搞了一个小程序,看看能不能用,希望大家一起来完善。同时希望金字塔官方参与进来,谢谢大家。

//不平日内开仓,且控制日内开仓不超过10手。
//如果资金比较大,且仓位不重的账户,可无视股指交易限制。技巧:多开一些对锁仓,交易结束前把10手开仓用完。
r1:=todaybar-1;
tn:=1;//每次交易手数,要和主程序的一致

r4:=stkindiex('ic00','qq24xz.持仓(1)',0,21,3,0),linethick0;//
//r5:=stkindiex('ic00','qq24.持仓(1)',0,21,3,0);

r6:=r4{+r5},linethick0;//可以进行多程序组合交易,后面的东西要做相应的改变
rr:r6-ref(r6,1),linethick1,noaxis;

r10:=TBUYHOLDING(1)-TBUYHOLDING(0);
r11:=abs(TSELLHOLDING(1))-abs(tsellholding(0));

//----------------------
GLOBALVARIABLE:a1=0;//用变量以前吃过亏,按下面使用a1能不能得到正确的值?
if r1=0 then a1:=0;

//*********************
if rr=-tn and r10>=tn then tsell(1,tn,lmt,c);//平仓或开空情况;
if rr=-tn and r10<tn and a1<=10-tn then 
begin
tbuyshort(1,tn,lmt,c);
a1:=a1+tn;
end
if rr=tn and r11>=tn then tsellshort(1,tn,lmt,c);//平仓或开多情况
if rr=tn and r11<tn and a1<=10-tn then 
begin
tbuy(1,tn,lmt,c);
a1:=a1+tn;
end

//------------平仓反手----------
if rr=-2*tn and r10>=tn then
begin
tsell(1,tn,lmt,c);
if a1<=10-tn then
begin
tbuyshort(1,tn,lmt,c);
a1:=a1+tn;
end
end
if rr=-2*tn and r10<tn and a1<=10-2*tn then
begin
tbuyshort(1,2*tn,lmt,c);
a1:=a1+2*tn;
end

if rr=2*tn and r11>=tn then
begin
tsellshort(1,tn,lmt,c);
if a1<=10-tn then
begin
tbuy(1,tn,lmt,c);
a1:=a1+tn;
end
end
if rr=2*tn and r11<tn and a1<=10-2*tn then
begin
tbuy(1,2*tn,lmt,c);
a1:=a1+2*tn;
end

//----------日内开仓次数超10次--------------如果对锁单不足,就要平日内单了。
if rr=tn and a1>10-tn then tsellshort(1,tn,lmt,c);
if rr=-tn and a1>10-tn then tsell(1,tn,lmt,c);

if rr=2*tn and a1>10-2*tn then tsellshort(1,2*tn,lmt,c);
if rr=-2*tn and a1>10-2*tn then tsell(1,2*tn,lmt,c);

//----------用光当天10次开仓次数--------------
rr2:=intpart((10-a1)/2);//这部分最好是手工开进去,要不然很容易自成交。手工开进去,TBUYHOLDING(1)能识别吗?
if currenttime>145955 and rr2>0 and rr=0 then
begin
tbuy(1,rr2,mkt);
tbuyshort(1,rr2,mkt);
end
 


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


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

//不平日内开仓,且控制日内开仓不超过10手。
//如果资金比较大,且仓位不重的账户,可无视股指交易限制。技巧:多开一些对锁仓,交易结束前把10手开仓用完。
r1:=todaybar-1;
tn:=1;//每次交易手数,要和主程序的一致

r4:=stkindiex('ic00','qq24xz.持仓(1)',0,21,3,0),linethick0;//
//r5:=stkindiex('ic00','qq24.持仓(1)',0,21,3,0);

r6:=r4{+r5},linethick0;//可以进行多程序组合交易,后面的东西要做相应的改变
rr:r6-ref(r6,1),linethick1,noaxis;

r10:=TBUYHOLDING(1)-TBUYHOLDING(0);
r11:=abs(TSELLHOLDING(1))-abs(tsellholding(0));

//----------------------
GLOBALVARIABLE:a1=0;//用变量以前吃过亏,按下面使用a1能不能得到正确的值?
if r1=0 then a1:=0;

//*********************
if rr=-tn and r10>=tn then tsell(1,tn,lmt,c);//平仓或开空情况;
if rr=-tn and r10<tn and a1<=10-tn then 
begin
tbuyshort(1,tn,lmt,c);
a1:=a1+tn;
end
if rr=tn and r11>=tn then tsellshort(1,tn,lmt,c);//平仓或开多情况
if rr=tn and r11<tn and a1<=10-tn then 
begin
tbuy(1,tn,lmt,c);
a1:=a1+tn;
end

//------------平仓反手----------
if rr=-2*tn and r10>=tn then
begin
tsell(1,tn,lmt,c);
if a1<=10-tn then
begin
tbuyshort(1,tn,lmt,c);
a1:=a1+tn;
end
end
if rr=-2*tn and r10<tn and a1<=10-2*tn then
begin
tbuyshort(1,2*tn,lmt,c);
a1:=a1+2*tn;
end

if rr=2*tn and r11>=tn then
begin
tsellshort(1,tn,lmt,c);
if a1<=10-tn then
begin
tbuy(1,tn,lmt,c);
a1:=a1+tn;
end
end
if rr=2*tn and r11<tn and a1<=10-2*tn then
begin
tbuy(1,2*tn,lmt,c);
a1:=a1+2*tn;
end

//----------日内开仓次数超10次--------------如果对锁单不足,就要平日内单了。
if rr=tn and a1>10-tn then tsellshort(1,tn,lmt,c);
if rr=-tn and a1>10-tn then tsell(1,tn,lmt,c);

if rr=2*tn and a1>10-2*tn then tsellshort(1,2*tn,lmt,c);
if rr=-2*tn and a1>10-2*tn then tsell(1,2*tn,lmt,c);

//----------用光当天10次开仓次数--------------
rr2:=intpart((10-a1)/2);//这部分最好是手工开进去,要不然很容易自成交。手工开进去,TBUYHOLDING(1)能识别吗?
if currenttime>145955 and rr2>0 and rr=0 then
begin
tbuy(1,rr2,mkt);
tbuyshort(1,rr2,mkt);
end
 


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


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

不好意思,股指没有今仓和昨仓的问题。只要今天开仓,那么平仓全按平今算,所以上面的程序没有意义了。

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


加好友 发短信
等级:小飞侠 帖子:1966 积分:0 威望:0 精华:1 注册:2013/6/15 21:56:35
  发帖心情 Post By:2016/4/3 17:55:50 [只看该作者]

程序最了修改,发表在“交易策略发布区”,有兴趣的去那里看看吧。感觉不错。

 回到顶部