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 Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      571 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      330 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      548 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      548 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X