From what I can tell, you and my support rep might not be on the same page. I have asked them to reach out to you privately so they can remote into your PC to ensure we understand your issue and that it is properly answered.
The following user says Thank You to NinjaTrader for this post:
Favorite Futures: Futures - bonds, currencies, index
Posts: 288 since Oct 2010
Thanks: 70 given,
No idea, I just tried it and it happens for me too. The data box shows values for the days not plotted too.
To be honest, I'm used to Ninja's calculations/indicators starting at random times for charts and backtesting, and I sort of live with it. I shouldn't have to though.
(I actually calculate daily indicators seperately direct from the feed and keep them in files which my strategy loads. I just don't really trust Ninja to have all the right data, to know whether it's going to load new data, to pause my strat while it calculates historical, to get the right start date etc etc)
Indicators have a property known as BarsRequired. The default value of this is 20 bars. What this does is that it prevents the plotting (not calculation) of the indicator until the BarsRequired criteria is met. If you wish for the indicator to plot earlier you could add this line into the Initialize() method of the indicator:
BarsRequired = 0;
Please note that usually plotting an indicator early with 0 bars required will show an “unstable” period when the indicator values are not properly calculating yet with enough data points. For example, on the EMA of period 5, the first 5 bars would be irrelevant EMA values since they aren’t really EMAs of period 5 yet since there aren’t 5 data points available. You could also try something like the line below to avoid plotting the “unstable” period, but begin plotting earlier than 20.
Thanks for making this clear. I had indeed used BarsRequired for some of my MTF indicators and they do not show this behaviour.
In this case this is simply a bug of the system indicators. If you display an EMA(55) it will include 35 bars of the unstable period. If you display an EMA(5) it will cut off 15 bars of the stable period.
So, why not add this line
BarsRequired = Period;
or similar (if applicable) to all system indicators?
No no this is no good.
If you use indicators with several lengths? Should it start from the biggest?
If you have a multi timeframe strategy (5min & 1 day) and you use an indicator only for 5 min time series.
The "BarsRequired" is applied to all bar series, so if automatically it will be equal to the longest indicator (lets say you use SMA(200)) then it wont plot for 200 days!
Its more complicated then appears from the first look.
The code is part of the indicator and has no impact on other indicators. It is not applied to a bar series. The "BarsRequired" will not be equal to the indicator with the longest period, as the value of "BarsRequired" is different for each indicator. I am just talking of how to code an indicator correctly.
If you have a multi-timeframe indicator, BarsRequired must be set within that indicator, otherwise it will not work correctly. The question I asked does not relate to new indicators, as you can code them in the way you like.
SMA(200): The question is, if you want to plot false values for the SMA(200), because every value plotted earlier than for CurrentBar = 200 has nothing to do with a SMA(200). The data is not available on the chart.
So you prefer false data to no data? I prefer no data to false data!