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

楼主 |
发表于 2024-4-22 12:17
|
显示全部楼层
代码修改成如下这样会不会好些
variable:opensnum:=0,addsum:=0;
if date<>ref(date,1) then opensnum:=0;
if date<>ref(date,1) then addsum:=0;
todaykc:enterbars<=todaybar ;
//开平仓
if 开多条件 and opensnum<1 then
begin
sellshort(holding<0,holding,thisclose);
buy(holding=0,lots,thisclose);
if holding>0 then opensnum:=1;
end
//
if 开空条件 and opensnum<1 then
begin
sell(holding>0,holding,thisclose);
buyshort(holding=0,lots,thisclose);
if holding<0 then opensnum:=1;
end
if 加多条件 and addsum<1 then
begin
sellshort(holding<0,holding,thisclose);
buy(holding>=0,lots,thisclose);
if todaykc then addsum:=1;
end
//
if 加空条件 and addsum<1 then
begin
sell(holding>0,holding,thisclose);
buyshort(holding<=0,lots,thisclose);
if todaykc then addsum:=1;
end
|
|