Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Exit the same day as entry using daily bars

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

    Exit the same day as entry using daily bars

    NT** A Sell stop order placed at '3/8/2004 4:00:00 PM' has been ignored since the stop price is greater than or equal to close price of the current bar. This is an
    invalid order and subsequent orders may also be ignored. Please fix your strategy.

    The entry is at open. It is a big down day so the market closes below the ExitShortStop. How can I exit the same day as the entry? In real world if a stop order is penetrated the same day as the entry the exit is at the stop price. Does NinjaTrader not imitate real world trading when back-testing?

    #2
    Hello,

    Welcome to the NinjaTrader forums and thank you for your post!

    You will have to debug the price level for your stop order. Help for debugging your NinjaScript strategy is here:
    Debugging your NinjaScript Code

    You might consider other exit methods like ExitShort() which submit market orders when conditions are true. In backtesting, market orders are submitted at the open of the next bar following the condition.

    For more information on the discrepancies expected when backtesting versus real time, please see here:
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thanks for your suggestions. We did debug the above issue and used a different way to exit but still the same result.

      if (dataValue.Low < (Positions[0].AvgPrice - dataValue.Atr * entrySwing.StopAtrMultiplier))
      ExitLong(entrySwing.Name);

      For GE on 3/8/2004 the entry price is 32.50 the protective stop price is 32 and the close of the day is 31.83. Because the close is lower than the protective stop price NinjaTrader gives an error warning.

      Is there a way to get the NinjaTrader to recognize the day of the entry, such as MarketPosition, the same day as the entry, so that it will exit at the stop price the same day?

      So far we have tried ExitLong and ExitLongStop and neither of them exited on the same day as the entry. They both exited at the open the next day.

      Comment


        #4
        You can't submit this stop order as it's not valid, before submitting you would need to check in your code that you actually prepare a legit order, a good practice is checking again the current inside market when submitting your stop orders.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        558 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        324 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        545 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        547 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X