Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Entry/Exit Same Bar?

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

    Entry/Exit Same Bar?

    I am trading short term with 5 minute bars and have a problem when there is a decent move during one bar. If I enter a short trade on the bar and have my stop order working immediately, if the high of the bar is above the stop order I get the following error:

    "a BuyToCover stop order placed at '1/6'2009 2:40am' has been ignored since the stop price is less than or equal to the close price of the bar. This is an invalid order and subsequent orders may also be ignored. Please fix your strategy."

    This is happens on historical data but the problem is that it shuts my system down and leaves the position open and I cannot just start the data more recent because the indicators need more bars for the calculation. I would have thought the stop order would be triggered and the position would be closed out at a loss. What is the best way to fix this?

    GT

    #2
    GreenTrade,

    You need to fix the order to submit at a price that is valid. There is no other way.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Thanks for the quick response. Would something like this example work (strategy: Backtesting NinjaScript Strategies with an intrabar granularity) or is this for something else? If so, my understanding of the example is that the strategy works the same but you add a separate period (like 1 minute) and although the conditions will still be looked at in the larger time period the orders will be submitted on the 1 minute time period. Is that correct? Thanks!

      You can submit orders to different Bars objects. This allows you the flexibility of submitting orders to different timeframes. Like in live trading, taking entry conditions from a 5min chart means executing your order as soon as possible instead of waiting until the next 5min bar starts building. You can achieve this by


      GT

      Comment


        #4
        That is correct. If you want the higher granularity during backtesting you would want to try the reference sample.
        Josh P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        659 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        374 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        109 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        574 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        579 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X