I noticed strange behaviour while backtesting/optimizing my strategy.
This is my code for the trail:
//Trailing Stop during for LLA1 if (BESetLLA1 == true && ExistLLA1 == true && Close[0] > Close [1] // && Close[0] > (entryOrder50.AvgFillPrice + ([COLOR=Red][B]330[/B][/COLOR]* TickSize)) ) { stop50 = ExitLongLimit(1,true, DefaultQuantity, Close[0]-[COLOR=Red][B]20[/B][/COLOR]*TickSize, "trailStopLLA1", "LLA1"); Print(Time[0].ToString("dd/MM/yyyy") + ", " + Time[0].ToString("HH:mm:ss") + " Traitrl LLA 1 adjusted to " + (Close[0]-(111*TickSize))); }
Eventually I would also like to optimize the distance above my entry where my trail should kick in (the red '330'), but I noticed the same problem)
Screenshot one is a chart with the red 20 still in place, and screen 2 with the red 20 replaced by the 'Tr'. How come it closes at a different level ?? (FYI: I tried putting the calculation between brackets Close[0]-(Tr*TickSize), but that didn't help)
Comment