I'm currently trying to create a strategy that enters if price hits a certain percentage pull back of a candle from several candles ago thus I need to use Limit Orders. I think this might be causing an issue with my SetProfitTarget orders because my profit target calculations are accurate but they don't get filled during the backtest. I've provided a section/sample of my code that shows what I'm talking about. Could you please help me figure out what my issue is?
Code:
bullTarget = (((entryPrice - longCloseStopWickSL) * RProfitMultiplier) + entryPrice);
bullTarget2 = (((entryPrice - longCloseStopWickSL) * RProfitMultiplier2) + entryPrice);
Print("The target price for this trade is: " + bullTarget + " Time: " + Time[0]);
Print("The stop loss for this trade is: " + longCloseStopBodySL + " Time: " + Time[0]);
SetProfitTarget("Long", CalculationMode.Ticks, bullTarget);
SetStopLoss("Long", CalculationMode.Ticks, MaxSL, false);
SetProfitTarget("Long2", CalculationMode.Ticks, bullTarget);
SetStopLoss("Long2", CalculationMode.Ticks, MaxSL, false);
Long1 = EnterLongLimit(0, true, DefaultQuantity, entryPrice, "Long");
Long2 = EnterLongLimit(0, true, DefaultQuantity, entryPrice, "Long2");
Thank you!

Comment