variable:n1=0;
if 平仓条件 and 持仓判断 then begin
平仓语句;
if numprofit(1)>0 then n1:=0;
if numprofit(1)<0 then n1:=n1+1;
end
这段套在平仓语句里面
if 开仓条件 and barslast(n1=n)>=m and 持仓判断 then 开仓语句;
这句直接添加,原来的开仓语句保留
if cond1 and dycond1 and 平空条件A1 then begin
sellshort.........;
end
把上面的4句全部分开写,然后套入上面的
variable:n1=0; |
if 平空条件A1 then begin 平空1:SELLSHORT(,0,MARKET);; if numprofit(1)>0 then n1:=0; if numprofit(1)<0 then n1:=n1+1; end |
if 平多条件B then begin 平多1:SELL(,0,MARKET); if numprofit(1)>0 then n1:=0; if numprofit(1)<0 then n1:=n1+1; end |
后面的开多1要改成开多2
通用的开空1要改成开空2
两个开多1会报错