NinjaScript > Educational Resources > Tips >

Using Historical Bid/Ask Series

Print this Topic Previous pageReturn to chapter overviewNext page

New to NinjaTrader 7 is the ability to use historical bid and ask price series in your NinjaScript instead of only being able to use a last price series. The following outlines the intricacies of this capability:

 

You can have multiple bid/ask/last series in your NinjaScript indicator/strategy. Please use the Add() method to add these series to your script.
The historical bid/ask series holds all bid/ask events sent out by the exchange. This would not be equivalent to the bid/ask at a specific time a trade went off.
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.
When using a Market Replay, the series are synced by their timestamp. These timestamps are synced only to a 1-second level of tolerance.
In real-time, the events from the various series would be received in whichever sequence was sent out by the exchange

 

What this means is that:

- The exact sequence of a mix of bid/ask/last events will not be maintained while processing the historical data from multiple series.

- The exact sequence of the bid/ask/last events in relation to themselves individually will be maintained while processing the historical data from multiple series.