- The indicator works properly on start-up, however,
- When closing the indicators pop-up dialog window with OK the indicator, does not draw and the “infamous” obscure error is generated:
Error on plotting indicator 'AutoScale2Series'. Please check the 'OnBarUpdate' or the 'Plot' method: Index was outside the bounds of the array.
- Pressing F5 redraws the indicator correctly.
- The data series pop-up dialog closure does not cause any problems.
It got very annoying so I used brute force deletions until I located the problem which is, in a multi-Time Frame indicator, setting
AutoScale = false;
namespace NinjaTrader.Indicator
{
{
{
PlotStyle.Line, "Plot0"));
// Commenting any of the following three lines
// makes the problem disappear
Add(PeriodType.Minute, 1); /* Line 1 */
Overlay = true; // default is false /* Line 2 */
AutoScale = false; // default is true /* Line 3 */
protectedoverridevoid OnBarUpdate()
{
[Browsable(false)]
[XmlIgnore()]
public DataSeries Plot0
{
My workaround is do delete AutoScale = false; which I can Live Without, However:
- Is this a bug or is this behavior by Design? I have added what I discovered on the behavior to facilitate locating the problem.
- This situation should motivate generating a more descriptive error than:
Please check the 'OnBarUpdate' or the 'Plot' method: Index was outside the bounds of the array.
Which in this dummy indicator'OnBarUpdate' has no code and the Plot is not overridden!!!!!
Thanks and kind regards.
Comment