Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy returns error when running live and cancels itself

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

    Strategy returns error when running live and cancels itself

    I keep getting these errors when running my strategy
    Attached Files

    #2
    I am also having the same issue.
    I'm running primary strategy on MNQ, trading NQ.
    It works just fine in market replay... but getting these errors:
    Strategy 'aaaHalgo_October24/329546214' submitted an order that generated the following error 'Order rejected'. Strategy has sent cancel requests, attempted to close the position and terminated itself.
    Disabling NinjaScript strategy 'aaaHalgo_October24/329546214'​

    Comment


      #3
      I am getting this error (trying to forward test the strategy...) but this is during live market hours (8:04PM Eastern on Sunday evening)
      Click image for larger version

Name:	image.png
Views:	309
Size:	7.5 KB
ID:	1322836

      Comment


        #4
        Actually, I figured out the issue for my case. My strategy was trying to place orders on an expired instrument (NQ 9-24) because I forgot to change the settings after backtesting. samish18 you might want to check that on yours if you're running two instruments.

        Comment


          #5
          Hello samish18,

          'The current price is outside the price limits set for this product', typically means the price of the order is too far from the trading action.

          In the script, print GetCurrentAsk() one line above printing the order.ToString() in OnOrderUpdate() (and temporarily use the RealtimeErrorHandling.IgnoreAllErrors while debugging).

          This should show us what the ask is at the moment the stop order is submitted and what the order price was.

          Below is a link to a support article on adding debugging prints to understand behavior.


          Save the output to a text file (right-click the output window, select Save as) and attach this to your next post.
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            Since I am setting a profitTarget and stopLoss, does this mean price is changing too fast and outside of those bounds before NT has a chance to execute the take profit and stop loss orders?

            Comment


              #7
              Hello samish18,

              That's a possibility. I won't know until the requested information is provided.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Hi Chelsea, if it is indeed the case that price is changing too fast what can we do? Do we have to change the limit to a market order instead to ensure that it fills? I find that I get this error more when I do update on price change other than on each tick

                Comment


                  #9
                  Hello ruudawakening,

                  If that was the issue, you would need to choose a stop price that is closer to the trading action. Or you could choose to submit a market order that fills immediately.

                  However, we'll know more about what is causing the issue once you have provided the requested output.
                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #10
                    How do I get it to print orders to string using the strategy builder? I selected trade orders in default properties and it’s still not printing and there is no order management under the print function in strategy builder?

                    Comment


                      #11
                      Hello ruudawakening,

                      The 'Debugging with the Strategy Builder' video linked from the 'Debugging using Print() and TraceOrders' article suggested in post # 5 demonstrates adding prints with the Strategy Builder.

                      However, the OnOrderUpdate() override cannot be implemented in the Strategy Builder. This gives information about the order price, state, and time which is necessary information for this issue and would require unlocking the script and coding by hand.

                      Chelsea B.NinjaTrader Customer Service

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by NullPointStrategies, Yesterday, 05:17 AM
                      0 responses
                      65 views
                      0 likes
                      Last Post NullPointStrategies  
                      Started by argusthome, 03-08-2026, 10:06 AM
                      0 responses
                      139 views
                      0 likes
                      Last Post argusthome  
                      Started by NabilKhattabi, 03-06-2026, 11:18 AM
                      0 responses
                      75 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