Help me, please. I'd like to program a trailing stop. It seems everything is OK, but it does't work. What did I wrong? The code is
PP:=Simulation.CurrentPositionProfit / Simulation.CurrentPositionValue;
condition1:= PP<0.1;
condition2:= (PP>= 0.1 and PP<0.3);
condition3:= (PP>= 0.3 and PP<0.5);
condition4:= (PP>= 0.5 and PP<0.7);
condition5:= (PP>= 0.7 and PP<0.9);
condition6:= PP>= 0.9;
c<ref(LLV(c,20),-1) or
(if(condition6,
PP<0.75,
if(condition5,
PP<0.5,
if(condition4,
PP<0.3,
if(condition3,
PP<0.1,
if(condition2,
PP<0.05,PP<-0.1))))))