
等级: 标准版
- 注册:
- 2022-6-27
- 曾用名:
|
为啥都这样组合了,持仓监控器的结果还是会闪烁。而且持仓结果也不对。。。
aholding:stkindiex('','策略a',0,1,0,1000); //引用1分钟周期上的策略a的holding值。
bholding:stkindiex('','策略b.cc',0,4,0,500); //引用30分钟周期上的策略b的holding值。
Cholding:stkindiex('','策略c.cc',0,21,3,1000); //引用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
sellshort (平空开多,abholding1,thisclose);
buy (平空开多,abholding0,thisclose);
end
开多:buy(开多条件,abs(abholding0),thisclose);
加多:buy(加多条件,abs(abholding0-abholding1),thisclose);
减多:sell(减多条件,abs(abholding0-abholding1),thisclose);
清多:sell(清多条件,abs(abholding0-abholding1),thisclose);
//空头开平仓
if 平多开空 then begin
sell (平多开空,abholding1,thisclose);
buyshort (平多开空,abholding0,thisclose);
end
开空:buyshort(开空条件,abs(abholding0),thisclose);
加空:buyshort(加空条件,abs(abholding0-abholding1),thisclose);
减空:sellshort(减空条件,abs(abholding0-abholding1),thisclose);
清空:sellshort(清空条件,abs(abholding0-abholding1),thisclose);
////
当前持仓:holding,colorgray,linethick0;
当前资产:asset,noaxis,colorgray;
|
|