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 sjsj2732, Yesterday, 04:31 AM
      0 responses
      33 views
      0 likes
      Last Post sjsj2732  
      Started by NullPointStrategies, 03-13-2026, 05:17 AM
      0 responses
      286 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      286 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      133 views
      1 like
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      91 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Working...
      X