I can view this data on a chart and I've confirmed the data on the chart matches the data in the historical database.
That works as I would expect, but when I run a strategy on the same instrument that is already loaded into a chart, data in the chart is reloaded via the strategy running and then the Bid and Ask data in the chart no longer matches the Bid and Ask data in the historical database as it did before I ran the strategy. Though, unlike the Bid and Ask values that no longer match the historical database data, after running the strategy, the "Last" data values on the chart do still match the historical database data “Last” values. After running a strategy, all the OHLC values for every Bid and Ask bars are one penny apart as can be seen in the Data Box screenshot.
Is this a bug? I see on this help page:
https://ninjatrader.com/support/help...ick_replay.htm
It states:
Note: I'm running the strategy via Playback via the "Historical" radio button option as seen in the attached screenshots.
I've tried the following code examples which all yielded data that does not exist in the historical database:
example 1: with Tick Replay turned off
Per documentation:
https://ninjatrader.com/support/help...nt8/getbid.htm
protected override void OnBarUpdate() { Print("output " + Close[0] + " " + Bars.GetBid(CurrentBar) + " " + Bars.GetAsk(CurrentBar) + " " + Cbi.Connection.PlaybackConnection.Now.ToString("HH :mm:ss.fff") ); }
example 2: with Tick Replay checked on for the strategy
Per documentation:
https://ninjatrader.com/support/help...ick_replay.htm
&
https://ninjatrader.com/support/help...aeventargs.htm
protected override void OnMarketData(MarketDataEventArgs marketDataUpdate) { // Print some data to the Output window if (marketDataUpdate.MarketDataType == MarketDataType.Last) { Print("Last = " + marketDataUpdate.Price + " " + Cbi.Connection.PlaybackConnection.Now.ToString("HH:mm:ss.fff") ); } else if (marketDataUpdate.MarketDataType == MarketDataType.Ask) { Print("Ask = " + marketDataUpdate.Price + " " + Cbi.Connection.PlaybackConnection.Now.ToString("HH:mm:ss.fff") ); } else if (marketDataUpdate.MarketDataType == MarketDataType.Bid) { Print("Bid = " + marketDataUpdate.Price + " " + Cbi.Connection.PlaybackConnection.Now.ToString("HH:mm:ss.fff") ); } }
example 3: Using Historical Bid/Ask Series with Tick Replay turned off
Per documentation:
https://ninjatrader.com/support/help..._ask_serie.htm
else if (State == State.Configure) { AddDataSeries("ADBE", BarsPeriodType.Minute, 1, MarketDataType.Bid); AddDataSeries("ADBE", BarsPeriodType.Minute, 1, MarketDataType.Ask); } protected override void OnBarUpdate() { if(BarsInProgress == 0) { Print("Last " + BarsInProgress + " " + Open[0] + " " + High[0] + " " + Low[0] + " " + Close[0] + " " + Cbi.Connection.PlaybackConnection.Now.ToString("HH:mm:ss.fff") ); } else if(BarsInProgress == 1) { Print("Bid " + BarsInProgress + " " + Open[0] + " " + High[0] + " " + Low[0] + " " + Close[0] + " " + Cbi.Connection.PlaybackConnection.Now.ToString("HH:mm:ss.fff") ); } else { Print("Ask " + BarsInProgress + " " + Open[0] + " " + High[0] + " " + Low[0] + " " + Close[0] + " " + Cbi.Connection.PlaybackConnection.Now.ToString("HH:mm:ss.fff") ); } }
Comment