Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

get historical Bid/Ask in OnBarUpdate()

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

    get historical Bid/Ask in OnBarUpdate()

    Hello people
    I am trying to get historical bid ask tick data for each bar i.e 5mins. bars, without using tick replay, by adding the following line

    AddDataSeries(Instrument.MasterInstrument.Name, BarsPeriodType.Tick, 1, MarketDataType.Ask);
    AddDataSeries(Instrument.MasterInstrument.Name, BarsPeriodType.Tick, 1, MarketDataType.Bid);

    How do I access the bid ask tick prices that make up each primary bar in OnBarUpdate().
    I tried using the code below to print the tick prices, but it prints the same number of lines and prices for each primary Currentbar index

    if (BarsInProgress == 0 ){
    for(int i =0; i < BarsArray[0].TickCount; i++){
    Print(String.Format("Current Bar {0} Curr {1} ASK {2} Bid {3}",CurrentBar, BarsArray[0].TickCount, BarsArray[1].GetAsk(i), BarsArray[2].GetBid(i)));
    }
    }

    thanks in advance
    Last edited by aotubusen; 12-08-2020, 02:14 AM.

    #2
    Hello aotubusen,

    Thanks for your post.

    A primary bar that is built from Last data (actual trades,) would be built from Last ticks and would not be build from Bid/Ask ticks. Bid/Ask ticks are separate streams.

    You would use AddDataSeries(null, BarsPeriodType.Tick, 1, MarketDataType.Last); to add a single tick data series of Last ticks.

    I have also attached an example that can demonstrate calculating primary bar values with single tick data.

    I have also attached an example that shows identifying buys and sells from single tick data. You may compare this against the built in BuySellVolume indicator.

    We look forward to assisting.
    Attached Files

    Comment


      #3
      Of course. I don't know what I was thinking.

      thank you so much.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      52 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      71 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      38 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      99 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      60 views
      0 likes
      Last Post PaulMohn  
      Working...
      X