总体亏损还是光亏损加一起?
总体亏损就是:盈利+亏损,达到X元
光亏损就是:一天所有的亏损加一起,达到X元
1.
variable:n=0;
if 平多条件 and holding>0 then begin
sell........;
n:=numprofit(1)+n;
end
if 平空条件 and holding<0 then begin
sellshort......;
n:=numprofit(1)+n;
end
开仓条件加上N>=x
2.
variable:cs=0;
if 平多条件 and holding>0 then begin
sell......;
if numprofit(1)>=0 then cs:=0;
if numprofit(1)<0 then cs:=cs+1;
end
if 平空条件 and holding<0 then begin
sellshort.....;
if numprofit(1)>=0 then cs:=0;
if numprofit(1)<0 then cs:=c+1;
end
开仓条件加入cs<x
啊,不好意思忘记了
在所有代码最后加上这一段:
if time=closetime(0) then begin
n:=0;
cs:=0;
end