金字塔决策交易系统

 找回密码
 

微信登录

微信扫一扫,快速登录

搜索
查看: 2902|回复: 8

异常频繁交易

[复制链接]

227

主题

881

帖子

881

积分

等级: 免费版

注册:
2022-4-2
曾用名:
发表于 2023-6-27 10:53 | 显示全部楼层 |阅读模式
策略突然在1分钟内来回频繁交易,使用的是后台多策略组合。之前都没碰到过。这是啥情况

ah:stkindiex('','策略A.cc',0,21,3,10000);  //引用3分钟周期上的策略a的仓位。
bh:stkindiex('','策略B.cc',0,3,0,5000);  //引用15分钟周期上的策略b的仓位。
ch:stkindiex('','策略Ccc',0,2,0,15000);  //引用15分钟周期上的策略b的仓位。
zh:='';
total_holding:ah+bh+ch;                               //理论持仓


bh_new_month_t:=tbuyholdingex(zh,'',0);                                 //多头今仓
bh_new_month_y:=tbuyholdingex(zh,'',1)-tbuyholdingex(zh,'',0);          //多头老仓
sh_new_month_t:=tsellholdingex(zh,'',0);                                //空头近今仓
sh_new_month_y:=tsellholdingex(zh,'',1)-tsellholdingex(zh,'',0);        //空头老仓
new_month_kd_w:=tisremainex(1,zh,stklabel);                             //未成交开多单
new_month_pd_w:=tisremainex(2,zh,stklabel);                             //未成交平多单
new_month_kk_w:=tisremainex(3,zh,stklabel);                             //未成交开空单
new_month_pk_w:=tisremainex(4,zh,stklabel);                             //未成交平空单

new_month_jcc:(bh_new_month_y+bh_new_month_t)-(sh_new_month_y+sh_new_month_t)+(new_month_kd_w-new_month_kk_w);   //实际账户净持仓(不含平仓未成交单)


//
////理论持仓与实际持仓的判断
//if total_holding-new_month_jcc>0 and new_month_jcc>=0 then
//   tbuy(1,total_holding-new_month_jcc,lmt,o,0,zh);   
//      
//if total_holding-new_month_jcc>0 and new_month_jcc<0 then  begin
//   tsellshort(total_holding<0,total_holding-new_month_jcc,lmt,o,0,zh);
//   if total_holding>=0 then begin
//      tsellshort(1,new_month_jcc,lmt,o,0,zh);
//      tbuy(total_holding>0,total_holding,lmt,o,0,zh);
//      end
//   end
//      
//if total_holding-new_month_jcc<0 and new_month_jcc<=0 then
//   tbuyshort(1,abs(total_holding-new_month_jcc),lmt,o,0,zh);
//      
//if total_holding-new_month_jcc<0 and new_month_jcc>0 then begin      
//   tsell(total_holding>0,abs(total_holding-new_month_jcc),lmt,o,0,zh);      
//   if total_holding<=0 then begin
//     tsell(1,new_month_jcc,lmt,o,0,zh);
//     tbuyshort(total_holding<0,abs(total_holding),lmt,o,0,zh);
//     end
//   end      
//理论持仓与实际持仓的判断
if total_holding-new_month_jcc>0 and new_month_jcc>=0 then
   tbuy(1,total_holding-new_month_jcc,mkt,0,0,zh);   

if total_holding-new_month_jcc>0 and new_month_jcc<0 then  begin
   tsellshort(total_holding<0,total_holding-new_month_jcc,mkt,0,0,zh);
   if total_holding>=0 then begin
      tsellshort(1,new_month_jcc,mkt,0,0,zh);
      tbuy(total_holding>0,total_holding,mkt,0,0,zh);
      end
   end

if total_holding-new_month_jcc<0 and new_month_jcc<=0 then
   tbuyshort(1,abs(total_holding-new_month_jcc),mkt,0,0,zh);

if total_holding-new_month_jcc<0 and new_month_jcc>0 then begin      
   tsell(total_holding>0,abs(total_holding-new_month_jcc),mkt,0,0,zh);      
   if total_holding<=0 then begin
     tsell(1,new_month_jcc,mkt,0,0,zh);
     tbuyshort(total_holding<0,abs(total_holding),mkt,0,0,zh);
     end
   end      




补充内容 (2023-6-27 10:57):
还是我人工发现手工停止预警,不然还会来回频繁交易
截图202306271053239901.png

PleaceOrder.txt

349.03 KB, 下载次数: 5498

PleaceOrder.txt2023-06-27 10#30#15.txt

500.03 KB, 下载次数: 10030

回复

使用道具 举报

0

主题

1万

帖子

1万

积分

Rank: 8Rank: 8

等级: 超级版主

注册:
2021-5-18
曾用名:
gxx978
发表于 2023-6-27 11:03 | 显示全部楼层
1、你这些信号是不同的策略触发的啊,这种仓位汇总交易是不建议不同的策略交易同一个品种的啊,你无法保证仓位的一致性啊,建议自己先捋清楚代码的逻辑关系。
2、信号是满足了条件就会触发的,如果要了解为什么触发这一行的下单,你只能自行输出调试各个代码中的开平仓条件了。
金字塔提供一对一VIP专业技术指导服务,技术团队实时响应您的日常使用问题与策略编写。联系电话:021-20339086
回复

使用道具 举报

227

主题

881

帖子

881

积分

等级: 免费版

注册:
2022-4-2
曾用名:
 楼主| 发表于 2023-6-27 11:12 | 显示全部楼层
技术010 发表于 2023-6-27 11:03
1、你这些信号是不同的策略触发的啊,这种仓位汇总交易是不建议不同的策略交易同一个品种的啊,你无法保证 ...

金字塔机构版不是可以实现多策略组合交易吗
回复

使用道具 举报

0

主题

1万

帖子

1万

积分

Rank: 8Rank: 8

等级: 超级版主

注册:
2021-5-18
曾用名:
gxx978
发表于 2023-6-27 11:17 | 显示全部楼层
任何版本都可以实现多策略交易,但是也要考虑代码的逻辑结构啊,如果你多策略交易同一个品种,那就可能造成你实际账户的持仓不就和你引用过来的理论持仓不一致了嘛,那不就又触发了不断的开平来矫正仓位了嘛。所以你需要考虑你的这个多策略同品种的交易是否会影响你的图表理论持仓和实际账户持仓一致的策略执行。
金字塔提供一对一VIP专业技术指导服务,技术团队实时响应您的日常使用问题与策略编写。联系电话:021-20339086
回复

使用道具 举报

227

主题

881

帖子

881

积分

等级: 免费版

注册:
2022-4-2
曾用名:
 楼主| 发表于 2023-6-27 11:29 | 显示全部楼层
技术010 发表于 2023-6-27 11:17
任何版本都可以实现多策略交易,但是也要考虑代码的逻辑结构啊,如果你多策略交易同一个品种,那就可能造成 ...

多策略交易一个品种有问题吗。多策略交易同一个品种只要净头寸跟账户一致就行了啊。肯定是策略组合的代码问题
回复

使用道具 举报

0

主题

1万

帖子

1万

积分

Rank: 8Rank: 8

等级: 超级版主

注册:
2021-5-18
曾用名:
gxx978
发表于 2023-6-27 11:31 | 显示全部楼层
策略组合中是获取实际账户的持仓的啊,又不是获取这个策略开的实际持仓。别的策略开的仓位也会被这个组合策略获取到的啊。
金字塔提供一对一VIP专业技术指导服务,技术团队实时响应您的日常使用问题与策略编写。联系电话:021-20339086
回复

使用道具 举报

227

主题

881

帖子

881

积分

等级: 免费版

注册:
2022-4-2
曾用名:
 楼主| 发表于 2023-6-27 11:54 | 显示全部楼层
技术010 发表于 2023-6-27 11:31
策略组合中是获取实际账户的持仓的啊,又不是获取这个策略开的实际持仓。别的策略开的仓位也会被这个组合策 ...

一个账户只运行了一个后台多策略组合;没有其他的。是不是误解了,但是即使这样还是出现了这样的报撤单
回复

使用道具 举报

227

主题

881

帖子

881

积分

等级: 免费版

注册:
2022-4-2
曾用名:
 楼主| 发表于 2023-6-27 12:13 | 显示全部楼层
技术010 发表于 2023-6-27 11:31
策略组合中是获取实际账户的持仓的啊,又不是获取这个策略开的实际持仓。别的策略开的仓位也会被这个组合策 ...

代码直接这样写不行吗
ah:stkindiex('','策略A.cc',0,21,3,10000);  //引用3分钟周期上的策略a的仓位。
bh:stkindiex('','策略B.cc',0,3,0,5000);  //引用15分钟周期上的策略b的仓位。
ch:stkindiex('','策略Ccc',0,2,0,15000);  //引用15分钟周期上的策略b的仓位。
zh:='';
strategy_hold:ah+bh+ch;                               //理论持仓

ac_buy_hold:=tbuyholdingex(zh,'',2);                                 //多头总仓
ac_sell_hold:=tsellholdingex(zh,'',2);                                //空头近今仓


tot_account_hold:ac_buy_hold-ac_sell_hold;

//理论持仓与实际持仓的判断
if strategy_hold-tot_account_hold>0 and tot_account_hold>=0 then
   tbuy(1,strategy_hold-tot_account_hold,mkt,0,0,zh);   
      
if strategy_hold-tot_account_hold>0 and tot_account_hold<0 then  begin
   tsellshort(strategy_hold<0,strategy_hold-tot_account_hold,mkt,0,0,zh);
   if strategy_hold>=0 then begin
      tsellshort(1,tot_account_hold,mkt,0,0,zh);
      tbuy(strategy_hold>0,strategy_hold,mkt,0,0,zh);
      end
   end
      
if strategy_hold-tot_account_hold<0 and tot_account_hold<=0 then
   tbuyshort(1,abs(strategy_hold-tot_account_hold),mkt,0,0,zh);
      
if strategy_hold-tot_account_hold<0 and tot_account_hold>0 then begin      
   tsell(strategy_hold>0,abs(strategy_hold-tot_account_hold),mkt,0,0,zh);      
   if strategy_hold<=0 then begin
     tsell(1,tot_account_hold,mkt,0,0,zh);
     tbuyshort(strategy_hold<0,abs(strategy_hold),mkt,0,0,zh);
     end
   end         
回复

使用道具 举报

0

主题

1万

帖子

1万

积分

Rank: 8Rank: 8

等级: 超级版主

注册:
2021-5-18
曾用名:
gxx978
发表于 2023-6-27 13:09 | 显示全部楼层
1、哦,各个策略指定了交易账户了,那就没有关系,是可以的。这个策略只要没有别的策略交易到这个账户即可。
2、从日志中来,HT策略组合对176128账户不断的出现开空和平空,那可以输出下这个开空和平空的条件,那具体是哪个变量的不断的变化,导致不断的触发开仓和平仓。
金字塔提供一对一VIP专业技术指导服务,技术团队实时响应您的日常使用问题与策略编写。联系电话:021-20339086
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 微信登录

本版积分规则

手机版|小黑屋|上海金之塔信息技术有限公司 ( 沪ICP备13035422号 )

GMT+8, 2025-8-24 01:39 , Processed in 0.169814 second(s), 24 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表