Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Automated strategy order problems on live account

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

    Automated strategy order problems on live account

    Hello,

    Apparently there is a problem with my stop limit and take profit orders. They are being modified within my code at the close of each bar. I'm getting the error below and it halts running my strategy. It should be noted this is on a live cash account, and I do *not* see these errors in backtesting or Market Replay.
    Strategy 'LinRegSlope2012_LIVE/97898c6c46204814bc13b0e53bb53055' submitted an order that generated the following error 'UnableToChangeOrder'. Strategy has sent cancel requests
    Sell order stop price must be below last trade price affected Order: Sell 1 Stop @ 855.4

    Attached is the full log for you to take a look at as well as my strategy code.

    Thanks in advance for your help
    Last edited by fredb987; 12-19-2011, 11:02 AM.

    #2
    Hi fredb987,

    The reported message is clear on the reason for rejection. The stop order was modified to an invalid price and rejection message comes from your broker.

    Sell order stop price must be below last trade price affected Order: Sell 1 Stop @ 855.4

    You need to fix your strategy so that it's not modifying orders to invalid prices.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thanks, Ryan.

      That is my issue - looking at the trade price, the stop order price @ 855.4 was in fact below the market price at that time. On a 1 minute bar @ 9:37AM Eastern time EMD future had a high of 858.2 and a low of 856.9. The rejected order was below the market price, so it doesn't make any sense to me.

      Comment


        #4
        Thanks for the reply. I see what you mean, that from the historical data values it looks like the order at that price/time should be accepted. Please send me your log and trace files for today so that I may look into what occurred.

        You can do this by going to the Control Center-> Help-> Mail to Support.

        Please reference the following ticket number in the body of the email: 583666
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Thank you for sending in the files. The price the order is modified to is 857.9, which is invalid at the time.

          12/19/2011 9:37:13 AM|1|32|Name='Stop loss' New state=PendingChange Instrument='EMD 03-12' Action=Sell Limit price=0 Stop price=857.9 Quantity=1 Type=Stop Filled=0 Fill price=0 Error=NoError Native error=''

          This is the last traded price at the time order is modified:
          12/19/2011 9:37:13 AM 857.3 1
          Ryan M.NinjaTrader Customer Service

          Comment


            #6
            OK, I see now what happened.

            Since this trade was not profitable, would the proper way to exit it be so submit an action to close at 857.9 as a "take profit" order rather than "stop loss", even though it was not in profit?



            Originally posted by NinjaTrader_RyanM View Post
            Thank you for sending in the files. The price the order is modified to is 857.9, which is invalid at the time.

            12/19/2011 9:37:13 AM|1|32|Name='Stop loss' New state=PendingChange Instrument='EMD 03-12' Action=Sell Limit price=0 Stop price=857.9 Quantity=1 Type=Stop Filled=0 Fill price=0 Error=NoError Native error=''

            This is the last traded price at the time order is modified:
            12/19/2011 9:37:13 AM 857.3 1

            Comment


              #7
              Yes, that's one way to do it. There is different behavior with stop orders compared to limit orders. Stop order prices are sensitive to their position relative to the market, and rejected order state means your strategy is disabled.

              A limit order (submitted by SetProfitTarget() in your strategy) when modified to the "wrong" side, would be marketable and filled to exit your position. There won't be a rejection message for this, and your strategy would continue running.
              Ryan M.NinjaTrader Customer Service

              Comment


                #8
                Thanks for the explanation. I will change the stop loss to a take profit (limit) order and see how it goes.

                Comment


                  #9
                  You're welcome. Best of luck with the modifications and please let us know if we can assist further.
                  Ryan M.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by aa731, Today, 02:54 AM
                  0 responses
                  4 views
                  0 likes
                  Last Post aa731
                  by aa731
                   
                  Started by thanajo, 05-04-2021, 02:11 AM
                  3 responses
                  470 views
                  0 likes
                  Last Post tradingnasdaqprueba  
                  Started by Christopher_R, Today, 12:29 AM
                  0 responses
                  10 views
                  0 likes
                  Last Post Christopher_R  
                  Started by sidlercom80, 10-28-2023, 08:49 AM
                  166 responses
                  2,237 views
                  0 likes
                  Last Post sidlercom80  
                  Started by thread, Yesterday, 11:58 PM
                  0 responses
                  4 views
                  0 likes
                  Last Post thread
                  by thread
                   
                  Working...
                  X