No announcement yet.

Partner 728x90


BarsRequest not updating Bid/Ask

  • Filter
  • Time
  • Show
Clear All
new posts

    BarsRequest not updating Bid/Ask

    I'm not sure if this is a bug or if I'm doing something wrong, but the BarsRequest class, despite Triggering an update on each Tick, doesn't update the GetBid() or GetAsk() values.

    GetHigh() and GetLow() seem to work though....

    I've thrown together an indicator to highlight the issue (find attached) please advise.
    Attached Files

    Hello reach4thelasers,

    I've had a look at the indicator and performed my own tests. This does not look like it should be expected.

    We are investigating this matter further with the ticket ID TS-1078. I will update this post when more information becomes available.

    Once again, thank you for the report!

    EDIT: This issue has been noted as expected. Please read the post here:
    Last edited by NinjaTrader_Jim; 05-15-2017, 12:56 PM.
    JimNinjaTrader Customer Service


      DO bear in mind that GetBid and GetAsk have no known practical use, since they can NOT be used to determine where any particular trade happened relative to the current bid or ask at the time of the transaction. Users have been complaining about this problem for years. It was inherited from NT7.

      It happens because the bid, ask and last are in separate files that cannot be synchronized to each other. This is because there will always be multiple events in the same and different files that have the exact same millisecond time stamp. Not everyone who works at Ninjatrader seems to understand this issue.


        There's a bigger problem with the BarsRequest class - a much bigger problem. I've attached a slightly modified version of the spike indicator that prints out "Percent Complete" and Tick Count.

        If you place it on a 34 Tick Chart - along side the "Tick Counter" indicator. You will see they are totally out of sync. The bar on the chart does not close at the same time as the BarsRequest bars.

        I'm using this to build a trading Add-on - but it's TOTALLY useless if its not in sync with the chart.

        I need to know when a bar on the chart closes and what the High/Low are so that I can place a trade there, as it stands my add-on is working with different data to the chart.

        I'm not sure what to do now - this has totally screwed my project. Any ideas?
        Attached Files


          Yeah I know Ricam I am using the bid and ask price to trigger my my simulated stop exits.... And adding the spread on for any long entries or short exits.



            I've been working with BarsRequest objects and Bid-Ask data, and they work fine. The sync is correct.
            Just to prove it, I attached a log collected from data from the BarsRequest and at the same time a chart that collects data from another source: the OnMarketData event of the indicator.
            Both data streams are perfectly synchronized and have the same values. I've highlighted yellow four-bar delta data to make it look easy. All other properties (Ask, Bid, Total, etc.) also match.
            Attached Files


              Hey CLS I'm definitely seeing these issues. Was anyone else able to observe the synchronisation problem with Tick charts? I would like to fix this over the weekend so if anyone has any ideas please let me know!


                Historical Bid Ask Data missing.

                I have been working through this issue for some time. Bottom line it looks like there is missing bid ask data which is causing gaps in historical data.

                You have to manually go in before you run a chart and do this for each new symbol and manually download historical bid ask. Even if you have this checked on your chart data series. Then once it download the data , bid ask data is missing for some bars.

                In the following pictures you will see where we have requested this bid ask data on the data series, even downloaded it manually which is near impossible to do for all users and all symbols and the we counted bars with bid ask data, and bars that are missing bid ask data ( even after download) .

                So far our indicators that rely on historical bid ask are useless on NT8.

                Just posting for support, not looking for any feedback on this one. Just hoping they get it fixed in future releases
                Attached Files
                Last edited by novaknexgen; 05-15-2017, 04:55 AM.


                  I can get around the Bid/Ask issue for what I'm using it for. I only need to know if my simulated stop is hit which is checked against the Ask for a short and the Bid for a long.

                  What is a much bigger problem for me is that BarsRequest is not in sync with the chart for Tick Charts which renders my addon pretty useless.

                  Can anyone help with this?!


                    Hello reach4thelasers,

                    Here is an example BarsRequest indicator that is written to be synchronized the OnBarUpdate().

                    In the provided sample, the value is printed after the time of the previous index has exceeded the time of the last bar close.

                    Also, I have heard back from the development team regarding getting Bid and Ask from BarsRequest. It is expected that you would not be able to get a the current bid and ask with GetBid() and GetAsk() because these do not have a barsAgo index.

                    You would be advised to use a Market Data handler for "OnMarketData()," like you would use a BarsRequest for "OnBarUpdate()." I am using quotations because these are private methods and not the overridden methods.


                    Please let me know if I may be of further assistance.
                    Attached Files
                    Last edited by NinjaTrader_Jim; 05-15-2017, 12:55 PM.
                    JimNinjaTrader Customer Service


                      Hey Jim,

                      Thanks for the response. That indicator was set up for a 10 second BarRequest. I changed the BarRequest params to use the Chart Timeframe, and added it to an 8 Tick Chart. This was the output:

                      15/05/2017 23:08:53 OnBarUpdate 146.598
                      15/05/2017 23:08:55 MyOnBarUpdate 146.599
                      15/05/2017 23:09:03 OnBarUpdate 146.602
                      15/05/2017 23:09:11 MyOnBarUpdate 146.601
                      15/05/2017 23:09:22 OnBarUpdate 146.601
                      15/05/2017 23:09:34 MyOnBarUpdate 146.597
                      15/05/2017 23:09:40 OnBarUpdate 146.593
                      15/05/2017 23:09:45 MyOnBarUpdate 146.599
                      15/05/2017 23:09:49 OnBarUpdate 146.603
                      15/05/2017 23:10:00 MyOnBarUpdate 146.6
                      15/05/2017 23:10:04 OnBarUpdate 146.599
                      15/05/2017 23:10:10 MyOnBarUpdate 146.6
                      15/05/2017 23:10:14 OnBarUpdate 146.599
                      15/05/2017 23:10:20 MyOnBarUpdate 146.599
                      15/05/2017 23:10:24 OnBarUpdate 146.596
                      15/05/2017 23:10:43 MyOnBarUpdate 146.61
                      15/05/2017 23:10:50 OnBarUpdate 146.611
                      15/05/2017 23:10:58 MyOnBarUpdate 146.615
                      15/05/2017 23:11:05 OnBarUpdate 146.606
                      15/05/2017 23:11:16 MyOnBarUpdate 146.613
                      15/05/2017 23:11:25 OnBarUpdate 146.616
                      15/05/2017 23:11:32 MyOnBarUpdate 146.613
                      15/05/2017 23:11:43 OnBarUpdate 146.613
                      15/05/2017 23:11:53 MyOnBarUpdate 146.616
                      15/05/2017 23:12:06 OnBarUpdate 146.618
                      15/05/2017 23:12:20 MyOnBarUpdate 146.617
                      15/05/2017 23:12:26 OnBarUpdate 146.616
                      15/05/2017 23:12:38 MyOnBarUpdate 146.624
                      As you can see from the Time-stamps and prices they are both out of sync. The bars close at different times and at different prices.
                      Attached Files


                        It's true, for example in 30-ticks there is not synchronization. But in 30-seconds and in 1-range yes. I only work with range bars and I was convinced that the sync worked well.
                        I assumed that if it worked well in range would work well on ticks as bars are formed in a similar way. But I see no.
                        Last edited by cls71; 05-16-2017, 02:44 PM.


                          Hello everyone,

                          After looking into this matter further, syncing ticks between a BarsRequest and a chart/indicator would not be possible.

                          From the Help Guide:
                          3. A BarsRequest provides underlying market data for an instrument, but is not synchronized with an indicator or strategies primary data series. You will need to implement your own BarsUpdateEvent logic.
                          The solution provided in the previous example is a workaround that can be used for time based bars, but it would not be applicable for tick data.

                          The bottom line is that the BarsRequest is separate from the internal logic that fills charts and indicators. As it takes place at a different time, it would not be possible to get the same values per each tick.
                          JimNinjaTrader Customer Service


                          Latest Posts


                          Topics Statistics Last Post
                          Started by michaelsh, Today, 04:28 PM
                          0 responses
                          Last Post michaelsh  
                          Started by Bmatarese, Today, 03:13 PM
                          1 response
                          Last Post NinjaTrader_ChrisL  
                          Started by sdauteuil, Today, 12:32 PM
                          4 responses
                          Last Post NinjaTrader_Jesse  
                          Started by Gaterz, 09-27-2020, 05:52 PM
                          10 responses
                          Last Post tcea9
                          by tcea9
                          Started by derivtrader, Today, 12:04 PM
                          1 response
                          Last Post NinjaTrader_Spencer