-- 作者:jinzhe
-- 发布时间:2015/1/8 11:04:23
--
variable:n=0,m=0;
if 平多语句 and holding>0 then begin
sell(1,0,marketr);
if numprofit(1)>0 then n:=n+numprofit(1);
if numprofit(1)<=0 then m:=m+numprofit(1);
end
if 平空语句 and holding>0 then begin
sell(1,0,marketr);
if numprofit(1)>0 then n:=n+numprofit(1);
if numprofit(1)<=0 then m:=m+numprofit(1);
end
然后n就是盈利的总和,m是亏损的总和,停止交易就是在开仓条件里面加上 n>=某个数值 and m<=某个数值
最后在加一句重置全局变量的:
if time=closetime(0) then begin
n:=0;
m:=0;
end
|