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 NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    58 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    133 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    73 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    45 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    50 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X