当帐面总赢利大于2000元或总亏损大于3000元时全部平仓的代码如何写
if openprofit>2000 or openprofit<-3000 then begin
sellshort(1,0,market);
sell(1,0,market);
end
variable:n=0;
if 开仓条件 then begin
平仓语句;
n:=1;
end
if n<>1 and 开仓条件 then 开仓语句;
以
if openprofit>2000 or openprofit<-3000 then begin
sellshort(1,0,market);
sell(1,0,market);
end
为例说明一下
if openprofit>2000 or openprofit<-3000 then begin//如果盈利大于2000或者亏损小于3000的话,执行一下动作
sellshort(1,0,market);//平空头
sell(1,0,market);//平多头
end//IF判断语句的结束语句
楼主知道shellshort,sell函数的用法吧,金字塔软件编程上有
但是执行完上述语句后,又开仓了,怎么办?我想是总赢利达到2000元后平仓,就不再开仓了,代码怎么写