Hello NT team,
From Google searching, I know that this error has been posted about numerous times; however, I am very confused as to how this happens given my current code logic.
For example, on a long, how is it even possible for a trailing stop to be set above market price?
You can see in my code snippit below that trailing stop is set to execute immediately upon entry. This error is being generated in slow markets, and the trailing stops are set at ~8 ticks on average. There is no way that price has moved so quickly that the trailing stop being dropped in would actually be above the entry price (i.e. current market price) that was entered milliseconds prior.
if (isLongConditionMet && Position.MarketPosition == MarketPosition.Flat)
{
// Print($"Entering Long Position at {Times[0][0]} at price {Closes[0][0]}");
EnterLong(Convert.ToInt32(DefaultQuantity), @"LongEntry");
SetStopLoss(CalculationMode.Ticks, MaxTicks); // Sets initial SL at MaxDollarRisk input
}
Could you help me understand what's going on here, and how I might be able to eliminate this from happening? I'd rather not turn off RealtimeErrorHandling, if possible. My understanding is doing this would prevent a trailing SL being implemented at all (leaving me in a position with no SL) if this error is thrown, no?

Comment