等级: 免费版
- 注册:
- 2022-4-2
- 曾用名:
|
请问老师这样写可以吗
VARIABLE:opensnum:=0,addsum:=0;
if date<>ref(date,1) then opensnum:=0;
if date<>ref(date,1) then addsum:=0;
//开平仓
if 开多条件 and opensnum<1 then begin
sellshort(holding<0,holding,market);
buy(holding=0,lots,market);
opensnum:=1;
end
//
if 开空条件 and opensnum<1 then begin
sell(holding>0,holding,market);
buyshort(holding=0,lots,market);
opensnum:=1;
end
if 加多条件 and addsum<1 then begin
sellshort(holding<0,holding,market);
buy(holding>=0,lots,market);
addsum:=1;
end
//
if 加空条件 and addsum<1 then begin
sell(holding>0,holding,market);
buyshort(holding<=0,lots,market);
addsum:=1;
end |
|