Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Historical Bid/Ask Data

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

    Historical Bid/Ask Data

    I thought I remembered hearing that historical bid/ask data would be available in NT8. How would I access this from an indicator?

    #2
    Hello,

    It sounds like you are looking for the TickReplay setting, which will process historical bars according to the actual flow of Bid/Ask updates that occurred within each bar. You can find more information about enabling TickReplay at the link below:

    http://www.ninjatrader.com/support/h...ick_replay.htm

    Our documentation for enabling TickReplay in an indicator's code is currently under construction, but bear with us if you're developing your own indicator, and we should have it completed soon.
    Dave I.NinjaTrader Product Management

    Comment


      #3
      Thanks! Does this only work in Market Replay, or does it work on charts as well?

      Comment


        #4
        Hello,

        TickReplay should work on real-time charts, as well. It will allow the historical calculations of an indicator or strategy on a real-time chart to use the actual tick updates of the historical bars, the same as it is doing on the real-time bars on the chart.
        Dave I.NinjaTrader Product Management

        Comment


          #5
          OK I found it. Thanks!

          Comment


            #6
            hi,

            Does this actually provide bid/ask info ?

            Here's my code, it seems Bid/Ask info is simulated info, and with bid=last and ask=last+1.
            So i get always negative delta

            Moreover, the doc says in NinjaScript > Educational Resources > Tips >Using Historical Bid/Ask Series

            When processing your NinjaScript, the historical bid/ask series would have the historical portion triggered in the OnBarUpdate() method only. OnMarketData() method events for the historical bid/ask series would only be triggered in real-time.
            So where so we stand ? Is there the way to find on historical data, the bid/ask synced with every tick ?

            Code:
                    protected override void OnMarketData(MarketDataEventArgs e)
                    {
            
                        if (e.MarketDataType==MarketDataType.Last)
                        {    
                            int delta=0;
                            if (e.Price>=e.Bid)
                                delta=(int)e.Volume;
                            if (e.Price<=e.Ask)
                                delta=(int)-e.Volume;
                            
                            totalvolume += delta;
            
                            hi = Math.Max(hi, totalvolume);
                            lo = Math.Min(lo, totalvolume);
                        }

            Comment


              #7
              Originally posted by gomifromparis View Post
              hi,

              Does this actually provide bid/ask info ?

              Here's my code, it seems Bid/Ask info is simulated info, and with bid=last and ask=last+1.
              So i get always negative delta
              If the data series being used has no bid/ask data tied to the tick data we will fake in the bid/ask data. As long as your data source has the bid/ask tick data with volume, it should be completely accurate (as published by your data provider).


              Originally posted by gomifromparis View Post
              Moreover, the doc says in NinjaScript > Educational Resources > Tips >Using Historical Bid/Ask Series
              This is still written in the context of AddDataSeries() and using a MarketDataType.Bid/Ask-> Only works in OnBarUpdate.

              If you enable TickReplay however, OnMarketData will be fired for every tick that went into building that bar.

              Originally posted by gomifromparis View Post
              So where so we stand ? Is there the way to find on historical data, the bid/ask synced with every tick ?
              Yes - depending on your provider and what they support. Can you please clarify who you were testing with?
              MatthewNinjaTrader Product Management

              Comment


                #8
                I'm using AMP/Rithmic

                Comment


                  #9
                  Your post suggests that the last price is always equal to the bid price, which is not expected...

                  I've tested the tick replay on our NinjaTrader historical data servers and against Kinetick and can confirm the the last price does alternate between the bid and ask as I would expect using our tick replay feature.

                  To make sure we're on the same page regarding how tick replay is working: can you run a quick test and check if e.Price == e.Ask and ensure you're getting some prints? If the tick data was synthetically generated, that condition would never be true.

                  Also please do note that this tick replay data from a NinjaTrader data server would only work from the time period we started recording tick replay data, which would be after May 3 2015. Any data you're testing before that date which originated from a NinjaTrader historical data server, or was migrated from NinjaTrader 7 upon your own installation, would be synthetic data (which may be why you made the observation re: bid=last and ask=last+1)

                  Regarding your negative Delta: I guess I'm a little confused based off your test case, please correct me if I am wrong, but wouldn't both of these conditions always (mostly, for an instrument like the ES) be true?

                  Code:
                  if (e.Price>=e.Bid)  //e.Ask?
                  {
                      delta=(int)e.Volume;
                  }
                  if (e.Price<=e.Ask)  //e.Bid?
                  {
                      delta=(int)-e.Volume;
                  }
                  If the last price is current greater/equal to the bid price-> price would be less than the ask price

                  Conversely, if the last price was less/equal the ask-> price would be greater than or equal to the bid.

                  Since they're both true, the delta would always be a negative value... When I reverse the conditions, I get results I would expect based on how I understand a Delta Divergence Indicator to work.
                  MatthewNinjaTrader Product Management

                  Comment


                    #10
                    Sorry for wasting your time, guys, of course delta implementation was quick and dirty, and a little too dirty...
                    Works now, thanks.
                    Sorry again

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Mestor, 03-10-2023, 01:50 AM
                    16 responses
                    388 views
                    0 likes
                    Last Post z.franck  
                    Started by rtwave, 04-12-2024, 09:30 AM
                    4 responses
                    31 views
                    0 likes
                    Last Post rtwave
                    by rtwave
                     
                    Started by yertle, Yesterday, 08:38 AM
                    7 responses
                    29 views
                    0 likes
                    Last Post yertle
                    by yertle
                     
                    Started by bmartz, 03-12-2024, 06:12 AM
                    2 responses
                    22 views
                    0 likes
                    Last Post bmartz
                    by bmartz
                     
                    Started by funk10101, Today, 12:02 AM
                    0 responses
                    7 views
                    0 likes
                    Last Post funk10101  
                    Working...
                    X