Unexpected MarketIfTouched (MIT) Behavior in OnPriceChange Mode (First Tick)

Hello NinjaTrader Community,

I’m encountering a very puzzling issue with MarketIfTouched (MIT) orders in my NinjaScript strategies, and I’d appreciate any insights or confirmations from others who might have experienced this.

My observation is that when placing EnterLongMIT or EnterShortMIT orders under specific conditions, the order does not behave as a pending order waiting for a future price trigger. Instead, it seems to execute immediately, effectively like a market order, even when the trigger price is significantly far from the current market price.

Here’s a summary of what I’ve found through testing:

  • Scenario: Placing an EnterLongMIT (or EnterShortMIT) order within the OnBarUpdate() method when the strategy’s Calculate property is set to Calculate.OnPriceChange, and the order is submitted specifically on the IsFirstTickOfBar.
  • Observed Behavior:
    • Despite the MIT trigger price being miles away from the Current Close (e.g., for a long order, the trigger is well above the current market price), the order is immediately reported as Filled.
    • The fill price (AvgFillPrice) is the current market price at the time of execution, not the specified trigger price.
    • The order lifecycle progresses from Submitted to Accepted, Working, and then Filled almost instantly.
    • Crucially, there is no ErrorCode reported, nor any informative message in the Info field, indicating that this is not a rejection due to an invalid order or a typical broker error.

This suggests that the EnterLongMIT / EnterShortMIT function, in this specific OnPriceChange / IsFirstTickOfBarcontext, exhibits an “implementation quirk” or a specific internal processing logic that causes it to behave like a Marketorder, regardless of whether the trigger price has actually been reached at that precise moment. It doesn’t seem to hold the order as truly “pending” for a future trigger in this scenario.

Has anyone else encountered this specific behavior with MIT orders in NinjaTrader? If so, what workarounds or explanations have you found? My current approach to achieve a true “Market If Touched” behavior is to use a secondary, finer data series to manually monitor for the trigger price and then send a standard EnterLong() or EnterShort() market order when the condition is met.

Any feedback or shared experiences would be greatly appreciated!

Thanks in advance.