• 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

IB charts not loading despite successful connection

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

    IB charts not loading despite successful connection

    Hi,


    I have an IB account and would like to use data from that. Till NT7, IB connections (and thus the charts) were working fine, but I'm not able to get the charts to display for NT8. The chart keeps loading. I only see the "Loading..." text on the top left corner and no bar data (even after waiting for a long time ~ 1hr+)

    I'm logged into a paper IB account (I do have a real account) and the port set in my IB global config is 7497 (not 7496 - but I doubt this could cause a problem). Everything else is the same as default in https://ninjatrader.com/ConnectionGu...nnection-Guide.

    The port is also set to 7497 in the configuration menu in NT8 main window for "IB" option. Has there been any other major change between NT7 and NT8 in this regard? I'm not why I'm not able to get data from IB working in NT8, but everything as it is working fine on NT7.

    I also verified that the API connection was made by checking the "Connections" menu in IB - and I was able to verify the correct client id of the NT8 successfully connected (all green - in both NT8 and IB)

    Other data feeds - the simulated data and free EOD data works, but IB does not.

    Where should I start looking to solve this problem? Any suggestions?

    Please let me know if I need to provide any additional information.







    #2
    Hello tmmr34,

    Thank you for that information.

    This is likely caused by the version of Traders Workstation you're using on your machine.

    Using Interactive Brokers as a connection with NinjaTrader 8 requires a specific version of Traders Workstation (TWS) to be installed (version 973.2) which is different than the version needed for NinjaTrader 7. Using NinjaTrader 8 with any other version of the TWS platform will result in unexpected behavior as these versions are not supported.

    I would recommend removing the current version of TWS and following the link below to install the correct version.For your reference, the following link will take you to a page that details the steps required for creating a connection to Interactive Brokers and specific connection configuration information.Additionally, the port isn't required to be 7496, you just need to ensure that this number matches in both TWS API settings and your NinjaTrader configuration setup. Differing numbers here will prevent you from successfully connecting.

    Please let me know if you need additional assistance.
    Heath R.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Heath View Post
      Hello tmmr34,

      Thank you for that information.

      This is likely caused by the version of Traders Workstation you're using on your machine.

      Using Interactive Brokers as a connection with NinjaTrader 8 requires a specific version of Traders Workstation (TWS) to be installed (version 973.2) which is different than the version needed for NinjaTrader 7. Using NinjaTrader 8 with any other version of the TWS platform will result in unexpected behavior as these versions are not supported.

      I would recommend removing the current version of TWS and following the link below to install the correct version.For your reference, the following link will take you to a page that details the steps required for creating a connection to Interactive Brokers and specific connection configuration information.Additionally, the port isn't required to be 7496, you just need to ensure that this number matches in both TWS API settings and your NinjaTrader configuration setup. Differing numbers here will prevent you from successfully connecting.

      Please let me know if you need additional assistance.
      Thanks, Heath! It works now!

      I have both versions installed and there are no problems now.
      Although, I'm a bit surprised - so basically, NT8 only works with the STABLE (973) version of TWS, but NT7 works even with the latest version (977). I hope the latest version support for NT8 is added soon.



      Comment


        #4
        Hi Heath,

        Sorry to re-open this issue, but I'm facing the same problem with charts again. Using NT8 with TWS version 973 (from that link you provided).
        After opening a chart - it loads the historical data that was saved from previous sessions, but if I click on "Reload all historical data", then the "loading" text appears on the top left and it just keeps saying "loading" - nothing happens in the chart. If I change symbol also, the same loading text is present. The log tab in NT main window is useless in debugging this issue. All it says is that the connection to TWS is established. Is there anything else I can look into to solve this? any other logs/settings?

        Edit 1: I just upgraded to 8.0.19.0 version of NT8 and I still have the same problem.

        Edit 2: Found the log files. Here are the logs after I tried opening a few charts:

        ```
        2019-10-10 02:33:17:954 (IB) Cbi.Connection.ConnectionStatusCallback: status=Connected priceStatus=Connected previousStatus=Connecting previousPriceStatus=Connecting errorCode=NoError nativeError=''
        2019-10-10 02:33:17:954 (IB) Cbi.Account.OnConnectionStatus: account='Sim101' fcm='' status=Connected previousStatus=Connecting message=''
        2019-10-10 02:33:17:954 (IB) Cbi.Account.Restore.Start: account='Sim101' fcm=''
        2019-10-10 02:33:17:954 (IB) Cbi.Account.Restore.End: account='Sim101' fcm=''
        2019-10-10 02:33:17:955 (IB) Core.Connection.Statistics: connectAttempts=4/1392.6ms
        2019-10-10 02:33:17:955 (IB) Cbi.Connection.ConnectionStatusCallback: autoClosePositionTime='03/11/2019 00:00:00' autoClosePosition=False
        2019-10-10 02:33:17:957 (IB) NinjaTrader.Gui.ControlCenter.OnConnectionStatus: InteractiveBrokers status=Connected priceStatus=Connected previousStatus=Connecting previousPriceStatus=Connecting errorCode=NoError nativeError=''
        2019-10-10 02:33:17:957 (IB) Cbi.Connection.Connect9 ok
        2019-10-10 02:33:17:958 (IB) IB.Adapter.OnError: id=-1 errorCode='MarketDataFarmConnectionOk' errorMessage='Market data farm connection is OK:hfarm'
        2019-10-10 02:33:17:958 (IB) IB.Adapter.ConnectionStatusHandler: ibStatus=Connected historical=Connected marketData=Connected
        2019-10-10 02:33:17:958 (IB) IB.Adapter.OnError: id=-1 errorCode='MarketDataFarmConnectionOk' errorMessage='Market data farm connection is OK:jfarm'
        2019-10-10 02:33:17:958 (IB) IB.Adapter.ConnectionStatusHandler: ibStatus=Connected historical=Connected marketData=Connected
        2019-10-10 02:33:17:958 (IB) IB.Adapter.OnError: id=-1 errorCode='MarketDataFarmConnectionOk' errorMessage='Market data farm connection is OK:usfuture'
        2019-10-10 02:33:17:958 (IB) IB.Adapter.ConnectionStatusHandler: ibStatus=Connected historical=Connected marketData=Connected
        2019-10-10 02:33:17:958 (IB) IB.Adapter.OnError: id=-1 errorCode='MarketDataFarmConnectionOk' errorMessage='Market data farm connection is OK:usfarm'
        2019-10-10 02:33:17:958 (IB) IB.Adapter.ConnectionStatusHandler: ibStatus=Connected historical=Connected marketData=Connected
        2019-10-10 02:33:17:958 (IB) IB.Adapter.OnError: id=-1 errorCode='HistoricalDataFarmConnected' errorMessage='HMDS data farm connection is OK:hkhmds'
        2019-10-10 02:33:17:958 (IB) IB.Adapter.ConnectionStatusHandler: ibStatus=Connected historical=Connected marketData=Connected
        2019-10-10 02:33:17:958 (IB) IB.Adapter.OnError: id=-1 errorCode='HistoricalDataFarmConnected' errorMessage='HMDS data farm connection is OK:ushmds'
        2019-10-10 02:33:17:958 (IB) IB.Adapter.ConnectionStatusHandler: ibStatus=Connected historical=Connected marketData=Connected
        2019-10-10 02:33:17:959 (IB) NinjaTrader.Gui.ControlCenter.OnConnectionStatus.D ispatcherInvoke: InteractiveBrokers status=Connected priceStatus=Connected previousStatus=Connecting previousPriceStatus=Connecting errorCode=NoError nativeError=''
        2019-10-10 02:33:17:959 (IB) Gui.ControlCenter.OnConnectionStatus.Adding: provider=InteractiveBrokers status=Connected priceStatus=Connected
        2019-10-10 02:33:17:959 NinjaTrader.Gui.ControlCenter.OnConnectionStatus: foundPriceLoss=False foundTradeLoss=False foundConnectingStatus=False foundConnected=True
        2019-10-10 02:33:17:959 NinjaTrader.Gui.ControlCenter.OnConnectionStatus: Status=Connected
        2019-10-10 02:33:17:966 Cbi.Instrument.RequestBars (to Provider): instrument='NFLX' from='7/10/2019 12:00:00 AM' to='10/10/2019 12:00:00 AM' period='1 Minute'
        2019-10-10 02:33:17:966 Cbi.Instrument.RequestBars (to Provider): instrument='ES' from='4/10/2019 12:00:00 AM' to='10/10/2019 12:00:00 AM' period='1 Minute'
        2019-10-10 02:33:17:967 Cbi.Instrument.RequestBars (to Provider): instrument='AMD' from='4/10/2019 12:00:00 AM' to='10/10/2019 12:00:00 AM' period='1 Minute'
        2019-10-10 02:33:17:973 Cbi.Instrument.RequestBars (to Provider): instrument='AAPL' from='7/10/2019 12:00:00 AM' to='10/10/2019 12:00:00 AM' period='1 Minute'
        2019-10-10 02:33:24:832 Cbi.Instrument.RequestBars (to Provider): instrument='AUDUSD' from='4/10/2019 12:00:00 AM' to='10/10/2019 12:00:00 AM' period='1 Minute'
        ```

        That's it - there's nothing after that last line.
        Last edited by tmmr34; 10-09-2019, 02:06 PM.

        Comment


          #5
          Hello tmmr34,

          Thank you for the reply.

          As a test can you close any workspaces you have open and then open one chart with an instrument that wouldn't load before,

          Also can you verify that you're approving the API connection request in TWS when you connect to your Interactive Brokers account in NinjaTrader?

          When using NinjaTrader with TWS, NinjaTrader works as a radio through the API simply relaying the information available from TWS, As you're using Interactive Brokers as a data feed, you may be running into a pacing violation with them, which occurs when requesting too much historical data from their feeds. For more information on this please see the link below:Unfortunately this error message comes from IB and informs you that you requested too much historical data.

          Please let me know if I may assist you further.

          Heath R.NinjaTrader Customer Service

          Comment


            #6
            Heath, I know about pacing violation and other nuances of the IB's API as I've worked directly with IB's API extensively in python.

            Does the log I posted above mention anything about pacing violation? Maybe I'm missing an error code I don't know about...
            Last edited by tmmr34; 10-10-2019, 10:45 AM.

            Comment


              #7
              Hello Tmmr34,

              Thank you for the update.

              I didn't see anything in the log you posted above however pacing violations don't always print in the log and trace files.

              Were you able to open the instrument using a new chart in an empty work space?

              What instrument were you trying to load that stuck on loading?

              Thank you I'll await your reply.
              Heath R.NinjaTrader Customer Service

              Comment


                #8
                Originally posted by NinjaTrader_Heath View Post
                I didn't see anything in the log you posted above however pacing violations don't always print in the log and trace files.
                It would be very useful if you could add a feature to log all of that. That way, at least those of us who are used to seeing IB's warnings and error messages can debug it ourselves. So, please consider adding another level of log for IB users.

                Originally posted by NinjaTrader_Heath View Post
                Were you able to open the instrument using a new chart in an empty work space?
                I tried opening normally now and it just worked. I didn't have to open a new workspace. Also, how can opening charts on a new workspace help this issue?
                I'm not able to fully reproduce what happened few days back, so that's why I was looking for logs. Without logs me just saying "charts didn't work despite doing all steps correctly" doesn't help you.

                Originally posted by NinjaTrader_Heath View Post
                What instrument were you trying to load that stuck on loading?
                I was trying to load ES 12-19, MES 12-19 and some popular S&P500 stocks. I had 4 chart windows open with 1 tab in each.

                -----

                I have some additional questions about charts and features of charts since we're on the same topic (I'm not sure if any of this could be related to using IB as the data provider, but I'm not sure if this required a separate thread)

                [Fixed]~~-Once I add an indicator to a chart, why isn't it saved when I close NT8 and re-open it? (after clicking on "YES" when it asks if I want to save the current workspace) Right now, I'm adding the indicators every time I'm opening the charts.~~ - I solved this - it was a serialization error in the script I was trying to save.

                -For the timeframe, how can I set how far back I can load the bars? For example, I'm looking at 30-min timeframe for stock NFLX and I'm only able to see data for the last 2 days. But I want to be able to see for something like the last several months - is this possible? if not, what is the max possible historical period you can load? I know that in IB API you can definitely request a LOT of data if the timeframe is high enough using `reqHistoricalBars`.

                -Is it possible to pan around the chart using a single hand - i.e, just using the mouse? I need to use the keyboard every time to press ctrl key to move in the y-axis. So, is it possible to assign mouse drag to x-axis movement and mouse scroll to y-axis movement? (right now, they do the same action - x-axis movement)


                Edit 2: I just tried opening the charts now - everything works well for now.
                Last edited by tmmr34; 10-11-2019, 06:18 AM.

                Comment


                  #9
                  Hello tmmr34,

                  Thank you for the update.

                  Regarding logging the pacing violations, this would require IB to make a change to TWS and the information that they submit through their API to the platform. In this instance we don't receive a signal from them as they don't send it to the platform through the API.

                  Opening a new chart without loading previous charts will not have the platform load historical data fro your prior workspaces and can help to mitigate pacing issues. Basically if you're not accessing those charts you're not hitting the data cap before you load the new instrument.

                  I'm glad to hear this issue is resolved for now. Please feel free to follow up if you have additional questions.
                  Heath R.NinjaTrader Customer Service

                  Comment


                    #10
                    Originally posted by NinjaTrader_Heath View Post
                    Hello tmmr34,
                    Regarding logging the pacing violations, this would require IB to make a change to TWS and the information that they submit through their API to the platform. In this instance we don't receive a signal from them as they don't send it to the platform through the API.

                    NT8 does use IB's API directly right?
                    Error 420 does exactly what we are talking about. https://interactivebrokers.github.io...age_codes.html

                    `Invalid Real-time Query: Historical data request pacing violation` (this is taken directly from one of the log files of a program I wrote which uses IB's API. So, IB's API does relay pacing violation messages via the API.


                    Also, can you please help to answer the 2 additional questions I've added to my last post? or if you want, I can create a separate topic for this.

                    Comment


                      #11
                      Hello tmmr34,

                      Thank you for the reply.

                      Apologies for missing those questions in my last reply. Let me address them first.

                      If you'd like to increase the days you're loading in a chart you can do so through the Data Series window by increasing the "Days to Load" property. The historical data you can load into the platform is only limited by 2 things:
                      1. The data available from your data provider. In some instances data providers may only allow you access to a certain period of information based on a specific timeframe, for instance the pacing violation that can occur when requesting too much historical data. I'm not aware of the limitations of TWS but you could reach out to Interactive Brokers to confirm.
                      2. The resources available by your system, if you have a chart with a lot of indicators that use a significant amount of resources in NinjaTrader, increasing days to load also increases the amount of calculation that those indicators will need to calculate for. This is going to be largely system specific and will require Trial and error to find the specific limitations of your system.

                      As for your new question, yes NinjaTrader does use the API from TWS in order to connect. However, our API connection to IB does not transmit that error to the platform, which is why it doesn't submit to our logs.

                      As an aside, the API version you have posted is from a newer version of TWS than the supported version with NinjaTrader 7 or 8. Using Interactive Brokers as a connection with NinjaTrader 8 requires a specific version of Traders Workstation (TWS) to be installed (version 973.2). Using NinjaTrader 8 with any other version of the TWS platform will result in unexpected behavior as these versions are not supported. NinjaTrader 7 requires versions 960.g as the supported version)


                      I have submitted this as a feature request to the Development Team to review and implement if possible. I will follow up with an internal tracking number for your reference as soon as it is created.

                      Thanks in advance for your patience.
                      Heath R.NinjaTrader Customer Service

                      Comment


                        #12
                        Hello Tmmr34,

                        Thanks for your patience.

                        The internal tracking number for your feature request is SFT-4312. Please reference this internal tracking number if you ever have questions regarding this feature request.

                        When a feature request is implemented, you'll find it in the release notes:

                        http://ninjatrader.com/support/helpG...ease_notes.htm

                        Thank you again for your patience.
                        Heath R.NinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Papercut110, Today, 09:08 PM
                        0 responses
                        2 views
                        0 likes
                        Last Post Papercut110  
                        Started by iq200, 11-09-2019, 08:26 AM
                        5 responses
                        56 views
                        0 likes
                        Last Post koganam
                        by koganam
                         
                        Started by johng964, Today, 02:57 PM
                        1 response
                        11 views
                        0 likes
                        Last Post NinjaTrader_RyanS  
                        Started by spamula, Today, 03:00 PM
                        2 responses
                        16 views
                        0 likes
                        Last Post spamula
                        by spamula
                         
                        Started by MARTIN MARTIN, Today, 01:01 PM
                        0 responses
                        16 views
                        0 likes
                        Last Post MARTIN MARTIN  
                        Working...
                        X