当持仓盈利回撤到盈利的80%的时候就平仓这个该怎么写啊?
variable:n=0;
if 开多条件 and holding=0 then begin
buy;
n:=h;
end
if h>n then n:=h;
if h<n and (c-enterprice)/(n-enterprice)<=0.8 then sell;
怎么不对啊,,,是不是我的用法错误啊?
variable:n=0;
yi:ma(c,5);
er:ma(c,20);
开多条件:=cross(yi,er);
if 开多条件 and holding=0 then begin
buy(1,1,THISCLOSE);
n:=h;
end
if h>n then n:=h;
if h<n and (c-enterprice)/(n-enterprice)<=0.8 then sell(1,1,THISCLOSE);
我想要的是开仓到目前的持仓盈利如果回撤到80%的时候平仓,,如果开仓到现在是亏损的话就不平就等信号出来平。
这个在图标上显示出来确成了直接亏损到80%也平了。是不是我没用对啊?