Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Orderflow bid/ask volume at price in historical

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

    Orderflow bid/ask volume at price in historical

    i see that orderflow bid/ask volumes at a price for the 5 min bar prints numbers with tick replay enabled. Are those number accurate? if not how are they calculated?

    on the language reference it says that bid/ask volumes are not available in historical tick replay but if i print the volumetric bars ask/bid volume at a price it appears to print numbers

    #2
    Hello Pole123,

    Thank you for your post.

    Here is the main note in the help guide about Tick Replay and historical bid/ask market data (such as volume):
    • "Tick Replay ONLY replays the Last market data event, and only stores the best inside bid/ask price at the time of the last trade event. You can think of this as the equivalent of the bid/ask price at the time a trade was reported. As such, historical bid/ask market data events (i..e, bid/ask volume) DO NOT work with Tick Replay. To obtain those values, you need to use a historical bid/ask series separately from Tick Replay through OnBarUpdate()​"
    It is also mentioned that a Tick Replay indicator or strategy should not be mixed with a MarketDataType.Ask or MarketDataType.Bid series. My understanding is that GetAskVolumeForPrice() and GetBidVolumeForPrice() from the Volumetric Bars are based on tick data and are not the same as the actual market data updates for MarketDataType.Bid and MarketDataType.Ask. If you take a look at the BuySellVolume indicator, for example, it can use Tick Replay to calculate historical values based on the MarketDataType.Last updates. It checks if the Price is greater than the Ask price or less than/equal to the Bid price to determine if it is a buy or a sell, then it tracks the volume. These values are based on the bid and ask tick values so they are close to accurate, but they may not match the actual market data updates. You could test out one indicator that adds a series for MarketDataType.Ask and MarketDataType.Bid and print out the Volume for each and compare that to the values you are getting from Volumetric bars with Tick Replay enabled to see if there are similarities/differences between the two.

    Please let us know if we may be of further assistance.
    Emily C.NinjaTrader Customer Service

    Comment


      #3
      So yes I see a difference between the realtime and historical order flow data series for GetAskVolumeForPrice() and GetBidVolumeForPrice() from the Volumetric Bars. How could I get the historical behaviour in the realtime market?

      while e BuySellVolume indicator​ seems consistent between realtime and historical

      Code:
      protected override void OnMarketData(MarketDataEventArgs e)
      
      {
      
      if(e.MarketDataType == MarketDataType.Last)
      
      {
      
      if(e.Price >= e.Ask)
      
      {
      
      if (AskMap.ContainsKey(e.Price))
      
      AskMap[e.Price] += e.Volume;
      
      else
      
      AskMap.Add(e.Price, e.Volume);
      
      
      
      
      
      }
      
      else if (e.Price <= e.Bid)
      
      {
      
      if (BidMap.ContainsKey(e.Price))
      
      BidMap[e.Price] += e.Volume;
      
      else
      
      BidMap.Add(e.Price, e.Volume);
      
      
      }
      
      }
      
      }
      
      
      
      protected override void OnBarUpdate()
      
      {
      
      
      
      if (BarsInProgress==0 && CurrentBars[0]>1)
      
      {
      
      if (IsFirstTickOfBar || Calculate == Calculate.OnBarClose)
      
      {
      
      AskMap.Clear();
      
      BidMap.Clear();
      
      AskMap.Add(Opens[0][0], 0);
      
      BidMap.Add(Opens[0][0], 0);
      
      }
      
      
      
      }
      
      }
      ​
      here is my indicator code for the ask/bid volume at a certain price.

      And here the output of the Volumetric GetAskVolumeForPrice VS my indicator:

      Code:
      NT8 ASK: 40 INDI ASK: 71 AT PRICE: 14487.5 | 10/25/2023 3:29:45 PM
      
      NT8 ASK: 40 INDI ASK: 72 AT PRICE: 14487.5 | 10/25/2023 3:29:45 PM
      
      NT8 ASK: 36 INDI ASK: 59 AT PRICE: 14487.75 | 10/25/2023 3:29:45 PM
      
      NT8 ASK: 36 INDI ASK: 60 AT PRICE: 14487.75 | 10/25/2023 3:29:45 PM
      
      NT8 ASK: 36 INDI ASK: 61 AT PRICE: 14487.75 | 10/25/2023 3:29:45 PM
      
      NT8 ASK: 36 INDI ASK: 64 AT PRICE: 14487.75 | 10/25/2023 3:29:45 PM
      
      NT8 ASK: 36 INDI ASK: 65 AT PRICE: 14487.75 | 10/25/2023 3:29:45 PM
      
      NT8 ASK: 25 INDI ASK: 29 AT PRICE: 14488 | 10/25/2023 3:29:45 PM
      
      NT8 ASK: 25 INDI ASK: 30 AT PRICE: 14488 | 10/25/2023 3:29:45 PM
      
      NT8 ASK: 19 INDI ASK: 35 AT PRICE: 14488.25 | 10/25/2023 3:29:45 PM
      
      NT8 ASK: 29 INDI ASK: 50 AT PRICE: 14487.25 | 10/25/2023 3:29:46 PM
      
      NT8 ASK: 29 INDI ASK: 50 AT PRICE: 14487.25 | 10/25/2023 3:29:46 PM
      
      NT8 ASK: 29 INDI ASK: 50 AT PRICE: 14487.25 | 10/25/2023 3:29:46 PM
      
      NT8 ASK: 29 INDI ASK: 50 AT PRICE: 14487.25 | 10/25/2023 3:29:46 PM
      
      NT8 ASK: 29 INDI ASK: 50 AT PRICE: 14487.25 | 10/25/2023 3:29:46 PM
      
      NT8 ASK: 44 INDI ASK: 72 AT PRICE: 14487 | 10/25/2023 3:29:46 PM
      
      NT8 ASK: 44 INDI ASK: 72 AT PRICE: 14487 | 10/25/2023 3:29:46 PM
      
      NT8 ASK: 53 INDI ASK: 50 AT PRICE: 14486.5 | 10/25/2023 3:29:46 PM
      
      NT8 ASK: 54 INDI ASK: 45 AT PRICE: 14486.25 | 10/25/2023 3:29:46 PM
      
      NT8 ASK: 54 INDI ASK: 45 AT PRICE: 14486.25 | 10/25/2023 3:29:46 PM
      
      NT8 ASK: 54 INDI ASK: 45 AT PRICE: 14486.25 | 10/25/2023 3:29:46 PM
      
      NT8 ASK: 54 INDI ASK: 45 AT PRICE: 14486.25 | 10/25/2023 3:29:46 PM
      
      NT8 ASK: 53 INDI ASK: 50 AT PRICE: 14486.5 | 10/25/2023 3:29:46 PM
      
      NT8 ASK: 54 INDI ASK: 46 AT PRICE: 14486.25 | 10/25/2023 3:29:46 PM
      
      NT8 ASK: 46 INDI ASK: 39 AT PRICE: 14486.75 | 10/25/2023 3:29:46 PM
      
      NT8 ASK: 53 INDI ASK: 50 AT PRICE: 14486.5 | 10/25/2023 3:29:46 PM
      
      NT8 ASK: 54 INDI ASK: 46 AT PRICE: 14486.25 | 10/25/2023 3:29:46 PM
      
      NT8 ASK: 54 INDI ASK: 46 AT PRICE: 14486.25 | 10/25/2023 3:29:46 PM
      
      NT8 ASK: 54 INDI ASK: 46 AT PRICE: 14486.25 | 10/25/2023 3:29:47 PM
      
      NT8 ASK: 51 INDI ASK: 80 AT PRICE: 14486 | 10/25/2023 3:29:47 PM
      
      NT8 ASK: 51 INDI ASK: 80 AT PRICE: 14486 | 10/25/2023 3:29:47 PM
      
      NT8 ASK: 51 INDI ASK: 80 AT PRICE: 14486 | 10/25/2023 3:29:47 PM
      
      NT8 ASK: 54 INDI ASK: 47 AT PRICE: 14486.25 | 10/25/2023 3:29:47 PM
      
      NT8 ASK: 51 INDI ASK: 80 AT PRICE: 14486 | 10/25/2023 3:29:47 PM
      
      NT8 ASK: 51 INDI ASK: 80 AT PRICE: 14486 | 10/25/2023 3:29:47 PM
      
      NT8 ASK: 51 INDI ASK: 81 AT PRICE: 14486 | 10/25/2023 3:29:47 PM
      
      NT8 ASK: 53 INDI ASK: 52 AT PRICE: 14486.5 | 10/25/2023 3:29:47 PM
      
      NT8 ASK: 53 INDI ASK: 53 AT PRICE: 14486.5 | 10/25/2023 3:29:47 PM
      
      NT8 ASK: 53 INDI ASK: 56 AT PRICE: 14486.5 | 10/25/2023 3:29:47 PM
      
      NT8 ASK: 53 INDI ASK: 57 AT PRICE: 14486.5 | 10/25/2023 3:29:47 PM
      
      NT8 ASK: 53 INDI ASK: 59 AT PRICE: 14486.5 | 10/25/2023 3:29:47 PM
      
      NT8 ASK: 46 INDI ASK: 41 AT PRICE: 14486.75 | 10/25/2023 3:29:47 PM
      
      NT8 ASK: 46 INDI ASK: 42 AT PRICE: 14486.75 | 10/25/2023 3:29:47 PM
      
      NT8 ASK: 53 INDI ASK: 60 AT PRICE: 14486.5 | 10/25/2023 3:29:47 PM
      
      NT8 ASK: 53 INDI ASK: 60 AT PRICE: 14486.5 | 10/25/2023 3:29:47 PM
      
      NT8 ASK: 46 INDI ASK: 45 AT PRICE: 14486.75 | 10/25/2023 3:29:47 PM
      
      NT8 ASK: 46 INDI ASK: 46 AT PRICE: 14486.75 | 10/25/2023 3:29:47 PM
      
      NT8 ASK: 46 INDI ASK: 47 AT PRICE: 14486.75 | 10/25/2023 3:29:47 PM
      
      NT8 ASK: 53 INDI ASK: 61 AT PRICE: 14486.5 | 10/25/2023 3:29:47 PM
      
      NT8 ASK: 53 INDI ASK: 62 AT PRICE: 14486.5 | 10/25/2023 3:29:47 PM
      
      NT8 ASK: 46 INDI ASK: 49 AT PRICE: 14486.75 | 10/25/2023 3:29:48 PM
      
      NT8 ASK: 53 INDI ASK: 62 AT PRICE: 14486.5 | 10/25/2023 3:29:48 PM
      
      NT8 ASK: 54 INDI ASK: 48 AT PRICE: 14486.25 | 10/25/2023 3:29:48 PM
      
      NT8 ASK: 54 INDI ASK: 48 AT PRICE: 14486.25 | 10/25/2023 3:29:48 PM
      
      NT8 ASK: 54 INDI ASK: 48 AT PRICE: 14486.25 | 10/25/2023 3:29:48 PM
      
      NT8 ASK: 54 INDI ASK: 48 AT PRICE: 14486.25 | 10/25/2023 3:29:48 PM
      
      NT8 ASK: 54 INDI ASK: 48 AT PRICE: 14486.25 | 10/25/2023 3:29:48 PM
      
      NT8 ASK: 51 INDI ASK: 82 AT PRICE: 14486 | 10/25/2023 3:29:48 PM
      
      NT8 ASK: 46 INDI ASK: 53 AT PRICE: 14486.75 | 10/25/2023 3:29:48 PM
      
      NT8 ASK: 46 INDI ASK: 54 AT PRICE: 14486.75 | 10/25/2023 3:29:48 PM
      
      NT8 ASK: 46 INDI ASK: 55 AT PRICE: 14486.75 | 10/25/2023 3:29:48 PM
      
      NT8 ASK: 44 INDI ASK: 73 AT PRICE: 14487 | 10/25/2023 3:29:48 PM
      
      NT8 ASK: 53 INDI ASK: 62 AT PRICE: 14486.5 | 10/25/2023 3:29:49 PM
      
      NT8 ASK: 54 INDI ASK: 48 AT PRICE: 14486.25 | 10/25/2023 3:29:49 PM
      
      NT8 ASK: 54 INDI ASK: 48 AT PRICE: 14486.25 | 10/25/2023 3:29:49 PM
      
      NT8 ASK: 54 INDI ASK: 48 AT PRICE: 14486.25 | 10/25/2023 3:29:49 PM
      
      NT8 ASK: 54 INDI ASK: 48 AT PRICE: 14486.25 | 10/25/2023 3:29:49 PM
      
      NT8 ASK: 46 INDI ASK: 57 AT PRICE: 14486.75 | 10/25/2023 3:29:49 PM
      
      NT8 ASK: 46 INDI ASK: 60 AT PRICE: 14486.75 | 10/25/2023 3:29:49 PM
      
      NT8 ASK: 46 INDI ASK: 61 AT PRICE: 14486.75 | 10/25/2023 3:29:49 PM
      
      NT8 ASK: 44 INDI ASK: 75 AT PRICE: 14487 | 10/25/2023 3:29:49 PM
      
      NT8 ASK: 44 INDI ASK: 77 AT PRICE: 14487 | 10/25/2023 3:29:49 PM
      
      NT8 ASK: 54 INDI ASK: 49 AT PRICE: 14486.25 | 10/25/2023 3:29:49 PM
      
      NT8 ASK: 53 INDI ASK: 64 AT PRICE: 14486.5 | 10/25/2023 3:29:49 PM
      
      NT8 ASK: 53 INDI ASK: 65 AT PRICE: 14486.5 | 10/25/2023 3:29:49 PM
      
      NT8 ASK: 54 INDI ASK: 50 AT PRICE: 14486.25 | 10/25/2023 3:29:50 PM
      
      NT8 ASK: 51 INDI ASK: 82 AT PRICE: 14486 | 10/25/2023 3:29:50 PM
      
      NT8 ASK: 30 INDI ASK: 54 AT PRICE: 14485.5 | 10/25/2023 3:29:50 PM
      
      NT8 ASK: 45 INDI ASK: 90 AT PRICE: 14485.25 | 10/25/2023 3:29:50 PM
      
      NT8 ASK: 45 INDI ASK: 90 AT PRICE: 14485.25 | 10/25/2023 3:29:50 PM
      
      NT8 ASK: 30 INDI ASK: 55 AT PRICE: 14485.5 | 10/25/2023 3:29:50 PM
      
      NT8 ASK: 30 INDI ASK: 58 AT PRICE: 14485.5 | 10/25/2023 3:29:50 PM
      
      NT8 ASK: 30 INDI ASK: 59 AT PRICE: 14485.5 | 10/25/2023 3:29:50 PM
      
      NT8 ASK: 38 INDI ASK: 68 AT PRICE: 14485.75 | 10/25/2023 3:29:50 PM
      
      NT8 ASK: 38 INDI ASK: 72 AT PRICE: 14485.75 | 10/25/2023 3:29:50 PM
      
      NT8 ASK: 38 INDI ASK: 73 AT PRICE: 14485.75 | 10/25/2023 3:29:50 PM
      
      NT8 ASK: 38 INDI ASK: 74 AT PRICE: 14485.75 | 10/25/2023 3:29:50 PM
      
      NT8 ASK: 38 INDI ASK: 75 AT PRICE: 14485.75 | 10/25/2023 3:29:50 PM
      
      NT8 ASK: 38 INDI ASK: 76 AT PRICE: 14485.75 | 10/25/2023 3:29:50 PM
      
      NT8 ASK: 51 INDI ASK: 86 AT PRICE: 14486 | 10/25/2023 3:29:50 PM
      
      NT8 ASK: 51 INDI ASK: 87 AT PRICE: 14486 | 10/25/2023 3:29:50 PM
      
      NT8 ASK: 51 INDI ASK: 88 AT PRICE: 14486 | 10/25/2023 3:29:50 PM
      
      NT8 ASK: 51 INDI ASK: 89 AT PRICE: 14486 | 10/25/2023 3:29:50 PM
      
      NT8 ASK: 54 INDI ASK: 50 AT PRICE: 14486.25 | 10/25/2023 3:29:50 PM
      
      NT8 ASK: 54 INDI ASK: 50 AT PRICE: 14486.25 | 10/25/2023 3:29:50 PM
      
      NT8 ASK: 54 INDI ASK: 50 AT PRICE: 14486.25 | 10/25/2023 3:29:50 PM
      
      NT8 ASK: 54 INDI ASK: 51 AT PRICE: 14486.25 | 10/25/2023 3:29:50 PM
      
      NT8 ASK: 53 INDI ASK: 67 AT PRICE: 14486.5 | 10/25/2023 3:29:50 PM
      
      NT8 ASK: 51 INDI ASK: 90 AT PRICE: 14486 | 10/25/2023 3:29:51 PM
      
      NT8 ASK: 54 INDI ASK: 54 AT PRICE: 14486.25 | 10/25/2023 3:29:51 PM
      
      NT8 ASK: 46 INDI ASK: 63 AT PRICE: 14486.75 | 10/25/2023 3:29:51 PM
      
      NT8 ASK: 53 INDI ASK: 70 AT PRICE: 14486.5 | 10/25/2023 3:29:51 PM
      
      NT8 ASK: 53 INDI ASK: 71 AT PRICE: 14486.5 | 10/25/2023 3:29:51 PM
      
      NT8 ASK: 46 INDI ASK: 65 AT PRICE: 14486.75 | 10/25/2023 3:29:51 PM
      
      NT8 ASK: 54 INDI ASK: 56 AT PRICE: 14486.25 | 10/25/2023 3:29:51 PM
      
      NT8 ASK: 53 INDI ASK: 74 AT PRICE: 14486.5 | 10/25/2023 3:29:51 PM
      
      NT8 ASK: 53 INDI ASK: 75 AT PRICE: 14486.5 | 10/25/2023 3:29:51 PM
      
      NT8 ASK: 51 INDI ASK: 90 AT PRICE: 14486 | 10/25/2023 3:29:51 PM
      
      NT8 ASK: 51 INDI ASK: 90 AT PRICE: 14486 | 10/25/2023 3:29:51 PM
      
      NT8 ASK: 51 INDI ASK: 93 AT PRICE: 14486 | 10/25/2023 3:29:52 PM
      
      NT8 ASK: 51 INDI ASK: 94 AT PRICE: 14486 | 10/25/2023 3:29:52 PM
      
      NT8 ASK: 51 INDI ASK: 95 AT PRICE: 14486 | 10/25/2023 3:29:52 PM
      
      NT8 ASK: 51 INDI ASK: 97 AT PRICE: 14486 | 10/25/2023 3:29:52 PM
      
      NT8 ASK: 54 INDI ASK: 62 AT PRICE: 14486.25 | 10/25/2023 3:29:52 PM
      
      NT8 ASK: 54 INDI ASK: 63 AT PRICE: 14486.25 | 10/25/2023 3:29:52 PM
      
      NT8 ASK: 54 INDI ASK: 64 AT PRICE: 14486.25 | 10/25/2023 3:29:52 PM
      
      NT8 ASK: 54 INDI ASK: 65 AT PRICE: 14486.25 | 10/25/2023 3:29:52 PM
      
      NT8 ASK: 54 INDI ASK: 66 AT PRICE: 14486.25 | 10/25/2023 3:29:52 PM
      
      NT8 ASK: 54 INDI ASK: 67 AT PRICE: 14486.25 | 10/25/2023 3:29:52 PM
      
      NT8 ASK: 51 INDI ASK: 98 AT PRICE: 14486 | 10/25/2023 3:29:52 PM
      
      NT8 ASK: 53 INDI ASK: 77 AT PRICE: 14486.5 | 10/25/2023 3:29:52 PM
      
      NT8 ASK: 46 INDI ASK: 67 AT PRICE: 14486.75 | 10/25/2023 3:29:53 PM
      
      NT8 ASK: 54 INDI ASK: 69 AT PRICE: 14486.25 | 10/25/2023 3:29:53 PM
      
      NT8 ASK: 51 INDI ASK: 98 AT PRICE: 14486 | 10/25/2023 3:29:53 PM
      
      NT8 ASK: 53 INDI ASK: 79 AT PRICE: 14486.5 | 10/25/2023 3:29:53 PM
      
      NT8 ASK: 53 INDI ASK: 81 AT PRICE: 14486.5 | 10/25/2023 3:29:54 PM
      
      NT8 ASK: 46 INDI ASK: 69 AT PRICE: 14486.75 | 10/25/2023 3:29:54 PM
      
      NT8 ASK: 51 INDI ASK: 98 AT PRICE: 14486 | 10/25/2023 3:29:54 PM
      
      NT8 ASK: 54 INDI ASK: 72 AT PRICE: 14486.25 | 10/25/2023 3:29:54 PM
      
      
      
      ​
      Last edited by Pole123; 10-25-2023, 01:35 PM.

      Comment


        #4
        Hello Pole123,

        Thank you for your reply.

        Getting the bid and ask volume from inside of a bar has been discussed in the following thread, which includes an example that makes dictionaries to track bid/ask volume for each bar:
        Hello everyone I am trying to get the bid ask volume inside the bar from the example the problem is that I need a method to get the bid and ask volume without tick replay. I am trying to create this indicator on my own - from the example of the developers But the result is without successfully Below is my code I ask for


        Please let us know if we may be of further assistance.
        Emily C.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by gustavobp, Today, 03:15 AM
        0 responses
        5 views
        0 likes
        Last Post gustavobp  
        Started by gustavobp, Today, 03:00 AM
        0 responses
        5 views
        0 likes
        Last Post gustavobp  
        Started by nicbizz, Today, 02:14 AM
        0 responses
        5 views
        0 likes
        Last Post nicbizz
        by nicbizz
         
        Started by Ringer13, Today, 01:59 AM
        0 responses
        7 views
        0 likes
        Last Post Ringer13  
        Started by NINZAMANA, 02-06-2025, 09:03 AM
        2 responses
        24 views
        0 likes
        Last Post Fertryd2  
        Working...
        X