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 charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        60 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        148 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        162 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        97 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        284 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Working...
        X