等级: 免费版
- 注册:
- 2022-4-2
- 曾用名:
|
策略突然在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):
还是我人工发现手工停止预警,不然还会来回频繁交易 |
|