variable:n=1;
if numprofit<0 then n:=n+1;
这是个类似示例,请楼主看看能不能自己尝试编写出来,如果有疑问,请跟贴说明
//目标:当日亏损交易次数超过3次,则不再开仓如何写?----图表交易 新交易函数
variable:lossnum=0;// 全局变量,平仓时判断一下是盈利/亏损,若亏损lossnum就加1if cond1 and holding>0 then
begin
sell(1,1,thisclose);
if c<enterprice then lossnum:=lossnum+1;
end
if cond2 and holding=0 and lossnum<3 then buy(1,1,thisclose);
if time=150000 then lossnum:=0;// 商品期货,收盘的同时,lossnum赋值为0
//收盘lossnum不赋值为0,后面就不再开仓了