“如果完成一次完整的开平仓以后,必须停止完整的开平仓5次”
意思是第1次完整的开平仓出信号,第2,3,4,5,6次满足条件的忽略不计?第7次在出信号交易?
通过全局变量处理类似下面(开仓条件是c>o)
VARIABLE:a=0;
if c>o and a=0 then begin
BUY(1,1,MARKET);
end
if c>o then begin
a:=a+1;
if a=6 then begin
a:=0;
end
end
VARIABLE:n=0,m=0;
if o<c and holding=0 then n:=n+1;
if o>c and holding>0 then m:=m+1;
if n=1 then buy(holding=0,1,market);
if m=1 then sell(holding>0,1,market);
if n=7 then n:=0;
if m=7 then m:=0