I have a problem with my stop loss: it gets triggered on the same bar as the entry. I set my stoploss at 2ATR below the price but I can't figure what the matter. Do you have an idea where does the problem come from?
Here is the piece of code that causes me this issue:
if (Close[0] > MAX(High,20)[1]) { EnterLong(DefaultQuantity, "Positive Breakout"); Variable0 = ATR(20)[0]; Variable1=Position.AvgPrice-5*Variable0; Print("Variables for Long Position"); Print(Variable0); Print(Position.AvgPrice); Print(Variable1); SetStopLoss("Positive Breakout", CalculationMode.Price, Variable1, false);
Manuel
Comment