and I want to determine that the chart has enough historical bars loaded in the Data Series, to ensure the averages being accumulated by the indicator will be reliable.
for example, with a live data connection, I open Ninjatrader, open a chart for a instr, and the data series Type : Minute, Value : 1
Time Frame has
" Load data based on : Days"
" Days to load : 1 "
but my indicator would work better if it had 3 days of historical data loaded.
My understanding is, NinjaTrader will process the historical bars and my indicator will perform it's calculations and build up the averages.
But this is not as plain and simple as using if CurrentBar < 20 etc.
If the current session on the active day doesn't have the calculated data I made, I make it look at the dictionary from the previous day to see if it has the data I want.
When the settings of the chart are not loading enough data to build up these collections of previous days of dictionaries, I want to display a warning on the chart.
So I try in State.DateLoaded
if (ChartBars.Properties.DaysBack < 2)
{
Print("number of days of DaysBack = "+ ChartBars.Properties.DaysBack );
Draw.TextFixed(this, "NinjaScriptInfo", "Adjust Data Set Days Back to grab at least 2 days worth of historical data, so this can collect avgs for each session", TextPosition.BottomRight);
}
And if I am testing using Playback connection, how does this affect the value?
i.e. if my playback , Market Replay Start = 04/27/2020 , End = 05/01/2020
and I position my GoTo to 04/29/2020 12:00:00 pm
there will be more than 1 days worth of 1 minute bars loaded on the chart, and the above code block will still show the warning message.
I intend to make this work on a live data connection, but I need to understand if this is the best practice approach for this while testing using a Playback Connection ?
Thank you

Comment