等级: 免费版
- 注册:
- 2022-4-2
- 曾用名:
|

楼主 |
发表于 2023-5-23 11:10
|
显示全部楼层
ah:stkindiex('','一箭穿心.cc',0,21,3,10000); //引用3分钟周期上的策略a的仓位。
bh:stkindiex('','震荡反转.cc',0,3,0,5000); //引用15分钟周期上的策略b的仓位。
ch:stkindiex('','波浪.cc',0,3,0,5000); //引用15分钟周期上的策略b的仓位。
zh:='176128';
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,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,0,zh);
if total_holding>=0 then begin
tsellshort(1,new_month_jcc,lmt,o,0,0,zh);
tbuy(total_holding>0,total_holding,lmt,o,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),lmt,o,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),lmt,o,0,0,zh);
if total_holding<=0 then begin
tsell(1,new_month_jcc,lmt,o,0,0,zh);
tbuyshort(total_holding<0,abs(total_holding),lmt,o,0,0,zh);
end
end |
|