
等级: 标准版
- 注册:
- 2022-6-27
- 曾用名:
|

楼主 |
发表于 2022-12-16 16:16
|
显示全部楼层
//account:'187917';
//
aholding:stkindiex('','ht日内vvtang.cc',0,1,0,5000); //引用1分钟周期上的策略a的holding值。
bholding:stkindiex('','ht震荡策略单周期mm.cc',0,4,0,1000); //引用30分钟周期上的策略b的holding值。
Cholding:stkindiex('','ht一箭穿心.cc',0,21,3,5000); //引用3分钟周期上的策略c的holding值。
//aholding:stkindi('','ht日内vvtangbolldual.cc',0,1,0); //引用1分钟周期上的策略a的holding值。
//bholding:stkindi('','wrsi震荡策略单周期mm.cc',0,4,0); //引用30分钟周期上的策略b的holding值。
//Cholding:stkindi('','一箭穿心.cc',0,21,3); //引用3分钟周期上的策略c的holding值
//
abholding0:aholding+bholding+cholding;
abholding1:ref(abholding0,1);
平空开多:=abholding0>0 and abholding1<0;
开多条件:=abholding0>0 and abholding1=0;
加多条件:=abholding0>0 and abholding1>0 and abholding0>abholding1;
减多条件:=abholding0>0 and abholding1>0 and abholding0<abholding1;
清多条件:=abholding0=0 and abholding1>0;
平多开空:=abholding0<0 and abholding1>0;
开空条件:=abholding0<0 and abholding1=0;
加空条件:=abholding0<0 and abholding1<0 and abholding0<abholding1;
减空条件:=abholding0<0 and abholding1<0 and abholding0>abholding1;
清空条件:=abholding0=0 and abholding1<0;
//多头开平仓
if 平空开多 then begin
tsellshort (平空开多,abholding1,lmt,c);
tbuy (平空开多,abholding0,lmt,c);
end
开多:tbuy(开多条件,abs(abholding0),lmt,c);
加多:tbuy(加多条件,abs(abholding0-abholding1),lmt,c);
减多:tsell(减多条件,abs(abholding0-abholding1),lmt,c);
清多:tsell(清多条件,abs(abholding0-abholding1),lmt,c);
//空头开平仓
if 平多开空 then begin
tsell (平多开空,abholding1,lmt,c);
tbuyshort (平多开空,abholding0,lmt,c);
end
开空:tbuyshort(开空条件,abs(abholding0),lmt,c);
加空:tbuyshort(加空条件,abs(abholding0-abholding1),lmt,c);
减空:tsellshort(减空条件,abs(abholding0-abholding1),lmt,c);
清空:tsellshort(清空条件,abs(abholding0-abholding1),lmt,c);
////
当前持仓:tholding,colorgray,linethick0;
当前资产:tasset,noaxis,colorgray;
|
|