Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Unmanaged Stop Orders - Ignored because of price range

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Unmanaged Stop Orders - Ignored because of price range

    Hi!

    I have the following problem (simplified):

    I enter a position via short stop order at the price of 10 (unmanaged). The High of that Bar (Bar where short stop was executed) is 12 which in realtime would of course be unknown when the short stop order is filled until the bar closes. After execution of that order I submit a buy stop order during OnExecutionUpdate at the price of 11 (unmanaged). The order is ignored because the High of the entry bar is higher than the Buy Stop price. If I submit the buy stop order at 12,01, everything works fine.

    So basically NT will always ignore the stop order in the backtest when the bar of execution has a wide range which exceeds the stop price levels even though that bar is not loaded/closed in OnBarUpdate yet.

    Questions:
    1. I know that this would be no problem in realtime but how can I avoid this in the backtest without using tick data?
    2. Is there a way that NT executes both the entry (shortstoporder) and the exit (buystoporder) in that same bar (so assuming that the High occured after the short stop order was executed)?
    3. How can I check the High and Low of the execution bar when the stop order is filled in OnExecutionUpdate (so basically looking one bar ahead of the most recent bar in OnBarUpdate in the historical data)?

    Thanks in advance!
    Last edited by KirkHammett; 08-26-2022, 01:37 AM.

    #2
    Hello KirkHammett,

    Thanks for your post.

    1. You could consider setting the Order Fill Resolution property to High Order Fill Resolution. Otherwise, there would be no supported way to accomplish this without using tick data.

    See this help guide page about Order Fill Resolution for more information: https://ninjatrader.com/support/help...resolution.htm

    And, see this help guide page about Order Fill Resolution: https://ninjatrader.com/support/help...FillResolution

    2. Yes, if you are not using OCO (one cancels other), two orders can fill in the same bar. When using OCO, if one order is filled, the other order will be canceled. By not using OCO, if one order is filled, the other order will not be canceled.

    3. It is not supported to "peek ahead" (look at a bar that has not formed) in NinjaTrader. That said, you could consider using Close.GetValueAt(CurrentBar+1) if you would like to try to "peek ahead" by 1 bar.

    See this help guide page for more information about GetValueAt: https://ninjatrader.com/support/help...getvalueat.htm

    Let me know if I may assist further.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    93 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    138 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    123 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    73 views
    0 likes
    Last Post PaulMohn  
    Working...
    X