• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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 MNinjaTrader 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 MNinjaTrader 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 MNinjaTrader 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 MNinjaTrader 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 MNinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by sgordet, Today, 10:31 PM
                  0 responses
                  1 view
                  0 likes
                  Last Post sgordet
                  by sgordet
                   
                  Started by Ilpropio, Today, 09:45 PM
                  0 responses
                  2 views
                  0 likes
                  Last Post Ilpropio  
                  Started by Revan, Today, 05:44 PM
                  1 response
                  14 views
                  0 likes
                  Last Post NinjaTrader_Marco  
                  Started by superg3, Today, 07:57 PM
                  0 responses
                  4 views
                  0 likes
                  Last Post superg3
                  by superg3
                   
                  Started by Longhornmark, Today, 07:06 AM
                  5 responses
                  35 views
                  0 likes
                  Last Post nkhoi
                  by nkhoi
                   
                  Working...
                  X