Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Failed IB order: Order rejected - reason:Invalid value in field # 126 (201) affected

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

    Failed IB order: Order rejected - reason:Invalid value in field # 126 (201) affected

    Hello,

    I have a strategy which works fine with different brokers (Zenfire, Vision), but for some reason fails with Interactive Brokers. I'm using IB Gateway. Whenever the strategy tries to execute an order via EnterLong(...) i get:

    Order rejected - reason:Invalid value in field # 126 (201) affected Order: Buy 3 Market

    The strange part here is that when I try to execute exactly the same order via NT manually it works fine. Instrument being used is CL 09-13

    This is what is being shown in IB GW log:
    06:56:25:565 <- 3-17-11-CL-FUT-201309-0---NYMEX-NYMEX-USD--BUY-3-MKT-0-0-GTD--UXXXXXXX-O-0--1-0-0-0-0-0-1-0-UXXXXXXX/3-0--20991201 00:00:00-----0--0-0---0---0-0--0------
    06:56:25:721 -> 4-2-11-2109-Order Event Warning:Attribute 'Outside Regular Trading Hours' is ignored based on the order type and destination. PlaceOrder is now being processed.-
    06:56:25:862 -> 5-10-11-CL-FUT-20130820-0-?-NYMEX-USD-CLU3-BUY-3-MKT-0.0-0.0-GTD--UXXXXXXX-O-0--0-789367946-0-0-0-------20991201 00:00:00 CST----0--0-------0-0-0-0--3-0-0--0-0-3-6-11-Inactive-0-3-0-789367946-0-0-0-
    06:56:25:862 -> 4-2-11-201-Order rejected - reason:Invalid value in field # 126-
    06:56:25:877 -> 5-10-11-CL-FUT-20130820-0-?-NYMEX-USD-CLU3-BUY-3-MKT-0.0-0.0-GTD--UXXXXXXX-O-0--0-789367946-0-0-0-------20991201 00:00:00 CST----0--0-------0-0-0-0--3-0-0--0-0-3-6-11-Inactive-0-3-0-789367946-0-0-0-

    And this is for the manual execution:

    07:07:53:222 <- 3-17-12-CL-FUT-201309-0---NYMEX-NYMEX-USD--BUY-3-MKT-0-0-GTC--UXXXXXXX-O-0--1-0-0-0-0-0-1-0-UXXXXXXX/3-0-------0--0-0---0---0-0--0------
    07:07:53:362 -> 4-2-12-2109-Order Event Warning:Attribute 'Outside Regular Trading Hours' is ignored based on the order type and destination. PlaceOrder is now being processed.-
    07:07:53:565 -> 11-9-12-CL-FUT-20130820-0.0--NYMEX-USD-CLU3-0000e9a5.51edd122.01.01-20130723 07:07:54-UXXXXXXX-NYMEX-BOT-1-106.3-789367947-0-0-
    07:07:53:565 -> 5-10-12-CL-FUT-20130820-0-?-NYMEX-USD-CLU3-BUY-3-MKT-0.0-0.0-GTC--U1180749-O-0--0-789367947-0-0-0-----------0--0-------0-0-0-0--3-0-0--0-0-3-6-12-PendingSubmit-1-2-106.30-789367947-0-106.30-0-
    07:07:53:659 <- 6-2-0-UXXXXXXX-
    07:07:53:659 <- 6-2-1-UXXXXXXX-
    07:07:53:799 -> 11-9-12-CL-FUT-20130820-0.0--NYMEX-USD-CLU3-0000e9a5.51edd123.01.01-20130723 07:07:54-UXXXXXXX-NYMEX-BOT-1-106.31-789367947-0-0-
    07:07:53:799 -> 5-10-12-CL-FUT-20130820-0-?-NYMEX-USD-CLU3-BUY-3-MKT-0.0-0.0-GTC--UXXXXXXX-O-0--0-789367947-0-0-0-----------0--0-------0-0-0-0--3-0-0--0-0-3-6-12-PendingSubmit-2-1-106.305-789367947-0-106.31-0-
    07:07:53:799 -> 11-9-12-CL-FUT-20130820-0.0--NYMEX-USD-CLU3-0000e9a5.51edd124.01.01-20130723 07:07:54-UXXXXXXX-NYMEX-BOT-1-106.31-789367947-0-0-
    07:07:53:799 -> 5-10-12-CL-FUT-20130820-0-?-NYMEX-USD-CLU3-BUY-3-MKT-0.0-0.0-GTC--UXXXXXXX-O-0--0-789367947-0-0-0-----------0--0-------0-0-0-0--3-0-0--0-0-3-6-12-Filled-3-0-106.306667-789367947-0-106.31-0-
    07:07:53:799 -> 5-10-12-CL-FUT-20130820-0-?-NYMEX-USD-CLU3-BUY-3-MKT-0.0-0.0-GTC--UXXXXXXX-O-0--0-789367947-0-0-0-----------0--0-------0-0-0-0--3-0-0--0-0-3-6-12-Filled-3-0-106.306667-789367947-0-106.31-0-
    07:07:53:799 -> 5-10-12-CL-FUT-20130820-0-?-NYMEX-USD-CLU3-BUY-3-MKT-0.0-0.0-GTC--UXXXXXXX-O-0--0-789367947-0-0-0-----------0--0-------0-0-0-0--3-0-0--0-0-3-6-12-Filled-3-0-106.306667-789367947-0-106.31-0-
    07:07:53:799 -> 5-10-12-CL-FUT-20130820-0-?-NYMEX-USD-CLU3-BUY-3-MKT-0.0-0.0-GTC--UXXXXXXX-O-0--0-789367947-0-0-0-----------0--0-------0-0-0-0--3-0-0--0-0-3-6-12-Filled-3-0-106.306667-789367947-0-106.31-0-
    07:07:53:799 -> 5-10-12-CL-FUT-20130820-0-?-NYMEX-USD-CLU3-BUY-3-MKT-0.0-0.0-GTC--UXXXXXXX-O-0--0-789367947-0-0-0-----------0--0-------0-0-0-0--3-0-0--0-0-3-6-12-Filled-3-0-106.306667-789367947-0-106.31-0-

    Please assist.

    Thank you!

    #2
    Hello gena72,

    To start the IB Gateway is not a supported way to connect and submit orders via NinjaTrader.

    With that said, the main difference I see is that the Strategy was submitting orders that IB Gateway considered GTD which may possibly be Good Til Day possibly?

    Then when you submitted the order manually it appears that the order was submitted GTC which was probably Good Til Cancelled, as you can probably confirm that via your Orders tab.

    If this is the case you may want to try to use the GTC orders via your Automated Strategy,


    Let us know if this helps.
    JCNinjaTrader Customer Service

    Comment


      #3
      Hello,

      I've tried using GTC with IB Gateway, and also with TWS, and unfortunately, i still get the same result: Invalid value in field # 126 (201) affected Order: Buy 3 Market.
      At this point I have no idea how to proceed, and I can not use my IB account with my automated strategy in any way.

      Comment


        #4
        While investigating this further I've created a simple script which only executes EnterLong(1), that's it. Now I get "Requested market data is not subscribed.Error&NYMEX/FUT/Top&NYMEX/FUT/Top 354". However, "manual" execution still works.
        I use Kinetick for real-time data and IB for execution only.

        Please assist.

        Comment


          #5
          Hello gena72,

          What version of NinjaTrader are you using? You can check under Help -> About (Example: 7.0.1000.X)

          You can verify what version of Interactive Broker's are you using under Help -> About -> Scroll down to the bottom and look for the Build #

          Do you have a real-time subscription to Kinetick for the exchanges that you are trying to trade? Note that the basic subscription for only has delayed data not real-time data.

          What instrument have you selected?


          Happy to be of further assistance.
          JCNinjaTrader Customer Service

          Comment


            #6
            Hello,

            I'm using NT7.0.1000.12, TWS Build (and IB GW) Build 939.2.
            I do have real-time suscription for Kinetick, in this case for NYMEX data.
            Instrument being used is the current CL future - CL 09-13.

            Hope this helps.

            Comment


              #7
              Hello gena72,

              You may want to use the supported versions of NinjaTrader and TWS just to make sure.

              The current version of NinjaTrader and Traders Workstation supported together is NinjaTrader 7.0.1000.14 and Traders Workstation 938.1

              You may upgrade NinjaTrader by:

              * Copying/write down your License Key by going to Control Center -> Help -> License Key
              * Then go to the Control Center -> Help -> Download Site
              * Shutdown NinjaTrader
              * Enter your license key under Current Users
              * Press Download NinjaTrader
              * Click on the NinjaTrader 7.0.1000.14 (Current) to download
              * Run the Setup.exe

              Since this is an upgrade none of your settings/files will be changed.

              Here is a link to our Connection Guide that has a link to download our supported version of TWS (938.1) that you may want to install.



              Once you are on the supported versions of each, please let us know your results.
              JCNinjaTrader Customer Service

              Comment


                #8
                Hello gena72,

                Doing some more checking the rejection code from IB 126 means that "Sell price must be the same as the best bidding price."



                So it may have to do with how the symbol is being mapped or the data is being sent to it. After you are running the two supported versions you may want to reset your instruments to make sure everything is set correctly.

                You may reset all of your default instruments by following the steps below.

                * Disconnect for all data providers
                * Go to the Control Center -> Tools.
                * Inside the Options window select the Data tab
                * Press the Reset Instruments button
                * Restart NinjaTrader
                * Note: Any changes made to original instruments settings will be reset.


                Happy to be of further assistance.
                JCNinjaTrader Customer Service

                Comment


                  #9
                  Hello,

                  I've done what you've suggested, upgraded NT and TWS to supported versions and reset all instruments. Now the orders placed by the automated strategy are not executed at all, there's no log entry in NT even.
                  In NT, if i enable order tracing in the output window i get:
                  21-Jul-13 17:01:00 Entered internal PlaceOrder() method at 21-Jul-13 17:01:00: BarsInProgress=0 Action=Buy OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='' FromEntrySignal=''
                  and that's it, no further effect whatsoever.
                  Manual execution still works. Looks very strange.

                  Comment


                    #10
                    Hello gena72,

                    Can you try just using the Traders Workstation (TWS) instead of the IB Gateway to be able to submit orders from your strategy successfully?
                    JCNinjaTrader Customer Service

                    Comment


                      #11
                      I am using TWS, as you recommended. Also, currently there's no difference between the two, the problem remains with both of them.

                      Comment


                        #12
                        Hello gena72,

                        Could you 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.

                        In the body of the message could you reference this thread:


                        Then in the subject line put: Attn: JC.

                        Happy to be of further assistance.
                        JCNinjaTrader Customer Service

                        Comment


                          #13
                          Update:

                          After updating to NinjaTrader 7.0.1000.14 and TWS 938.1 order were successfully able to be placed to IB using an Automated Strategy.
                          JCNinjaTrader Customer Service

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                          0 responses
                          633 views
                          0 likes
                          Last Post Geovanny Suaza  
                          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                          0 responses
                          364 views
                          1 like
                          Last Post Geovanny Suaza  
                          Started by Mindset, 02-09-2026, 11:44 AM
                          0 responses
                          105 views
                          0 likes
                          Last Post Mindset
                          by Mindset
                           
                          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                          0 responses
                          567 views
                          1 like
                          Last Post Geovanny Suaza  
                          Started by RFrosty, 01-28-2026, 06:49 PM
                          0 responses
                          568 views
                          1 like
                          Last Post RFrosty
                          by RFrosty
                           
                          Working...
                          X