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:	352
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 Mindset, 04-21-2026, 06:46 AM
                      0 responses
                      88 views
                      0 likes
                      Last Post Mindset
                      by Mindset
                       
                      Started by M4ndoo, 04-20-2026, 05:21 PM
                      0 responses
                      134 views
                      0 likes
                      Last Post M4ndoo
                      by M4ndoo
                       
                      Started by M4ndoo, 04-19-2026, 05:54 PM
                      0 responses
                      68 views
                      0 likes
                      Last Post M4ndoo
                      by M4ndoo
                       
                      Started by cmoran13, 04-16-2026, 01:02 PM
                      0 responses
                      119 views
                      0 likes
                      Last Post cmoran13  
                      Started by PaulMohn, 04-10-2026, 11:11 AM
                      0 responses
                      69 views
                      0 likes
                      Last Post PaulMohn  
                      Working...
                      X