Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Barchart and TDAmeritrade

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

    Barchart and TDAmeritrade

    I'm trying to use the Barchart.com data feed to drive my strategy and to execute trades in a couple of TDA accounts. I've followed the guidelines to connect to Barchart first, and then to the TDA accounts. I also unlinked my TDA accounts to eliminate a problem that NT Support identified. When I connect to all 3 and run backtests up to the present minute, results are the same as when I connect to Barchart only.

    But when I start a strategy on my TDA account(s), and then try to run another backtest, the backtest stops receiving live bar updates. Historical bars are there, but new bar updates stop after the point where I launched the live strategy. Are backtests blocked when a live strategy is running, or is there a conflict between my connections?

    j2

    #2
    1. Connect BarChart
    2. Connect to ONE TDA account
    3. Open chart, ensure bars are flowing
    4. Add SampleMACrossOver onto chart. Does it work?
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      I ran the test you suggested, and the data flow was fine. I then tried running my live strategy on the one TDA account, and data flow was fine. I then connected to the second TDA account and started my strategy on that account as well. I ran additional backtests, and data flow appeared to be fine up to the end of the day.

      I'll try more testing tomorrow after the market opens to see if I can isolate when/if the data flow locks up. I did notice that the chart inside the Strategy Analyzer had stopped adding bars back at about 1:20, market time. I changed the timeframe to 15-min and back to 30-min, and it refreshed up to the current time.

      Thanks for the suggestion of monitoring the chart. I don't usually track them, because I'm monitoring my diagnostics in the Output window.

      j2

      Comment


        #4
        This morning, I'm running my strategy live against both TDA accounts, and I opened 1-min charts on all 3 instruments in the strategy. Bars are flowing for the instruments added in the strategy, but bars are not flowing for the base instrument (IWM) against which the strategies are running. If I change the time-base of the IWM chart, it updates correctly, but then posts no updates.

        Backtests appear to be receiving up-to-date price data for all 3 instruments.

        j2

        Comment


          #5
          Not following you. How would backtests receive anything up to date? Strategy Analyzer does not receive real-time data like charts do.

          Anything in Control Center logs for runtime errors on strategies?

          Please try with a SINGLE account connected. See if that works first.
          Josh P.NinjaTrader Customer Service

          Comment


            #6
            By "up-to-date" I mean that the backtest reflects the latest price information up to the minute when I ran the backtest. There's nothing in the log indicating strategy errors or connection drops.

            I ran the single-connection test you suggested yesterday, and it appeared to run fine. That's why I moved on to the 2-connection test. As noted earlier, bars weren't flowing for the base instrument for the strategies, so I revised my strategy to run off a dummy instrument (e.g. SPY) and added all 3 instruments that I'm actually using. I stopped and removed the old strategies and went live with the revised strategy, using SPY as the base instrument. The bars are now flowing on all 3 instruments that I'm actually using.

            That appears to be a satisfactory workaround for this issue. Thanks again for suggesting the charts as a way to verify that bars are flowing.

            j2

            Comment


              #7
              Glad you got it resolved.
              Josh P.NinjaTrader Customer Service

              Comment


                #8
                I spoke too soon. Bars are flowing to the charts, but I added some diagnostic Print statements to the live strategy, and it shows that the OnBarUpdate events for the 30-minute bars aren't occurring. The OnBarUpdate diagnostics for the 1-minute bars are printing as expected.

                I stopped and removed the live strategies and went back to a single TDA connection. That also fails to update the 30-minute bars within the live strategy, after it starts. All the historical 30-minute bars appear in the run-up to the live strategy, but once it's running, no more 30-minute bars appear. The Print statements associated with the 30-minute bars don't show up, and the diagnostic Print statements in the 1-minute bars show that the CurrentBar number for the 30-minute bars is stuck on the value it had when the live strategy was started.

                j2

                Comment


                  #9
                  Post code of exactly what you are using. Just print from each BarsInProgress the respective timestamps. If you receive 1mins you have the data for 30mins.
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #10
                    Here's the print strategy I'm using. It prints from OnBarUpdate for 1-min bars, but shows the latest values for the 30-min bars as well. When I have a TDAmeritrade strategy running, the CurrentBar value for the 30-min bars stops incrementing and the price for the 30-min bars doesn't update.
                    Attached Files

                    Comment


                      #11
                      Please try remove all other series and only work with the problematic IWM. What happens then? Also, you should only be using this strategy you have attached and no others. Just run this strategy to your TDA.
                      Josh P.NinjaTrader Customer Service

                      Comment


                        #12
                        I cut down the PrintTest strategy to the minimum, as suggested (attached). I removed my connections, reset the DB, restarted, rebuilt my connections, connected to Barchart.com, connected to 1 of my TDA accounts, and started the PrintTest strategy against the TDA account. No other strategies are active, and I've run no backtests or simulations. I'll let you know what shows up in the Output window when the market opens.

                        j2
                        Attached Files

                        Comment


                          #13
                          Ok, please update us on your findings, thanks
                          BertrandNinjaTrader Customer Service

                          Comment


                            #14
                            I got the expected output for yesterday's closing bar at the market open this morning. That was with Barchart as the primary connection and the PrintTest strategy running against 1 TDA connection.

                            For the next 30-min update, I'm adding the other TDA connection and I'm running the PrintTest strategy against that connection as well. If that works, I'll try adding my trading strategy to one of the TDA connections, and keep testing until I succeed or recreate the problem.

                            Comment


                              #15
                              Both expected Print lines appeared in the Output window at the end of the opening half-hour. I'll start my trading strategy on 1 connection.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by arvidvanstaey, Today, 02:19 PM
                              4 responses
                              11 views
                              0 likes
                              Last Post arvidvanstaey  
                              Started by samish18, 04-17-2024, 08:57 AM
                              16 responses
                              60 views
                              0 likes
                              Last Post samish18  
                              Started by jordanq2, Today, 03:10 PM
                              2 responses
                              9 views
                              0 likes
                              Last Post jordanq2  
                              Started by traderqz, Today, 12:06 AM
                              10 responses
                              18 views
                              0 likes
                              Last Post traderqz  
                              Started by algospoke, 04-17-2024, 06:40 PM
                              5 responses
                              47 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Working...
                              X