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

楼主 |
发表于 2022-6-24 10:14
|
显示全部楼层
//多头开平仓
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);
A:DATE<>REF(DATE,1);
MM:COUNT(a,ENTERBARS); //计算持仓的天数
spcond :=OPENPROFIT<0 and mm>=n &&holding>0;
bpcond :=OPENPROFIT<0 and mm>=n &&holding<0;
时间止损卖:sell(spcond,holding,thisclose);
时间止损买:sellshort(bpcond,holding,thisclose); |
|