Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Strategy Builder - 'Modification rejected by the order management system....'

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

    Strategy Builder - 'Modification rejected by the order management system....'

    Hi

    I've got a simple strategy that I've created using strategy builder. I'm checking to make sure that market position is flat and if a couple of basic conditions are met, then I enter long with a stop order. I don't have any exit rules or conditions, except for a currency value stop loss and profit target.

    A trade was executed and had exceeded the profit target, but an error was displayed saying 'Modification rejected by the Order Management System - Order is complete. affected Order: Buy 1 StopMarket @ 19851'

    This then appears to leave the trade running without a take profit and possibly without a stop loss as well? I then manually closed the position and got a further error

    'Strategy xxxx submitted an order that generated the following error 'Unable to submit order'. Strategy has sent cancel requests, attempted to close the position and terminated itself'

    I'm connected to an account through Rithmic. Is there anything I'm doing wrong when creating a strategy which is causing this to happen, or anything I can put in place to prevent?

    Regards
    Dan


    #2
    Hello Dan_TUK,

    The error suggests that your strategy tried to modify the order after it was filled or complete which causes a rejection. That could be a timing issue, the builder has to keep calling the order method to keep the order alive so if you are using OnEachTick calculation that could result in this type of rejection. The order essentially would fill and your logic continues to try and update the order because the position event has not been received yet so the condition remains true while the order is filled.

    If you are using OnEachTick processing you could try using OnPriceChange instead to avoid calling the order method again so quickly. If that does not work for the market being traded you may need to modify the strategy by unlocking it and using a live until cancelled order, that lets you call the order method once and it remains active until filled. Alternatively a market order would need to be used so you don't need to keep calling the order method to keep it active.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hello Jesse

      Thanks for coming back to me. It was set to OnEachTick, so I've changed that to OnPriceChange. However, when I try to enable the strategy again, I'm getting the following error

      ' Strategy xxx submitted an order that generated the following error 'Unable to submit order'. Strategy has sent cancel requests, attempted to close the position and terminated itself'

      The strategy then won't enable. I've tried removing the strategy and setting it back up, but the same error message persists. Are you able to advise what the problem might be?

      I'm trying to avoid unlocking the code, if possible, as I was having problems with strategy scripts not setting a stop loss, while using an account through Rithmic.

      Regards

      Comment


        #4
        Hello Dan_TUK,

        The error you provided is a generic message when a strategy is being disabled due to an order error, there should be a secondary message along with that or if there was a rejection it would be in a separate error. Are you seeing any other errors in the control center log tab or NinjaScript output window?

        JesseNinjaTrader Customer Service

        Comment


          #5
          Apologies, yes, there are further messages in the output window, as follows :

          Strategy 'xxxxx': An order has been ignored since the stop price ‘19752.25’ near the bar stamped ‘06/24/2024 23:45:00’ is invalid based on the price range of the bar. This is an invalid order and subsequent orders may also be ignored.

          Enabling NinjaScript strategy 'xxxxx' : On starting a real-time strategy - StartBehavior=WaitUntilFlat EntryHandling=All entries EntriesPerDirection=1 StopTargetHandling=By strategy position

          ErrorHandling=Stop strategy, cancel orders, close positions ExitOnSessionClose=True / triggering 30 seconds before close SetOrderQuantityBy=Strategy ConnectionLossHandling=Recalculate DisconnectDelaySeconds=10 CancelEntriesOnStrategyDisable=False CancelExitsOnStrategyDisable=False Calculate=On price change IsUnmanaged=False MaxRestarts=4 in 5 minutes

          Strategy 'xxxxx' submitted an order that generated the following error 'Unable to submit order'. Strategy has sent cancel requests, attempted to close the position and terminated itself.

          Disabling NinjaScript strategy 'xxxxx'​


          and an additional error in the log

          25/06/2024 17:19:47,Order,XXXXX buy order stop price must be above trade price affected Order: Buy 1 StopMarket @ 19910.75,

          Comment


            #6
            Hello Dan_TUK,

            The ignored order warning is normal, that order was ignored historically based on the price it was submitted at not being within the range of the bar at that timestamp. That won't cause the strategy to disable.

            The other error says that the stop price must be above the traded price so that is likely the order causing the problem. The type of order being submitted is on the wrong side of the market when it was submitted which will cause a rejection. That may be if you are using a very close to market offset for the entry, you may need to increase the offset being used.

            JesseNinjaTrader Customer Service

            Comment


              #7
              Hi Jesse

              The entry wouldn't be that close, perhaps around 20 points away for this example. I did try clearing my Ninja Trader cache though and after restarting, am able to enable the strategy again, without the error being returned.

              Many thanks
              Dan

              Comment


                #8
                Hello Jesse

                After setting my strategy to OnPriceChange and then resolving the issue with not being able to enable that strategy, I've had a repeat today of my original issue. This strategy is running on two instruments, both of which have triggered a long trade today and both have exceeded the stop loss which I've set in Strategy Builder.

                I can see both entries on the Positions tab, but if I look on the Executions tab, I can only see one of the two instruments listed. Same if I run the Trade Performance report for today and look at the Executions.

                I can, however, see entries in the log to show where the orders were submitted.

                I also have an entry in the log, as previously 'Strategy xxxxx submitted an order that generated the following error 'Unable to change order'. Strategy has sent cancel requests attempted to close the position and terminated itself.'

                This has disabled one strategy, while the position remains open. The other strategy doesn't give this same error, hasn't been disabled, but the position is still running.

                EDIT : I've also now logged into Rithmic and the positions that I closed in Ninja Trader were still showing as open there.

                Is there any further advice you could offer, for how I could diagnose what's causing this to happen?

                Regards







                Last edited by Dan_TUK; 06-27-2024, 08:17 AM.

                Comment


                  #9
                  Hello Dan_TUK,

                  In that case you would need to likely unlock the strategy so a live until cancelled order can be used. If you are using OnPriceChange and there is still enough changes at once that could still have that same type of rejection. Unlocking the code would let you work with live until cancelled orders which do not need to be called again. The only other options to resolve this in the builder would be to use OnBarClose processing or market orders.

                  Regarding the discrepancy between rithmic and NinjaTrader, that generally would be unexpected. Is this something you see each time you use it or was it just once that happened?
                  JesseNinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by marco231, 03-20-2024, 03:56 PM
                  7 responses
                  172 views
                  0 likes
                  Last Post marco231  
                  Started by Irukandji, 04-22-2024, 04:33 AM
                  7 responses
                  35 views
                  0 likes
                  Last Post Irukandji  
                  Started by Irukandji, Today, 01:56 AM
                  0 responses
                  3 views
                  0 likes
                  Last Post Irukandji  
                  Started by Blaze212, Yesterday, 07:18 PM
                  1 response
                  12 views
                  0 likes
                  Last Post Blaze212  
                  Started by ramckay, Yesterday, 08:18 PM
                  0 responses
                  8 views
                  0 likes
                  Last Post ramckay
                  by ramckay
                   
                  Working...
                  X