#region Using declarations
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Gui;
using NinjaTrader.Gui.Chart;
using NinjaTrader.Gui.SuperDom;
using NinjaTrader.Gui.Tools;
using NinjaTrader.Data;
using NinjaTrader.NinjaScript;
using NinjaTrader.Core.FloatingPoint;
using NinjaTrader.NinjaScript.DrawingTools;
#endregion
namespace NinjaTrader.NinjaScript.Indicators
{
public class a1 : Indicator
{
Series<int> my;
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = @".";
Name = "a1";
Calculate = Calculate.OnBarClose;
IsSuspendedWhileInactive = true;
}
else if (State == State.Configure)
{
}
else if (State == State.DataLoaded)
{
my= new Series<int>(this);
}
}
protected override void OnBarUpdate()
{
if (CurrentBar<=1) Print(my[249]);
}
}
}
"You are accessing an index with a value that is invalid since it is out-of-range. ..."
My Question, how even `my` Serie can be called for the index that doesn't exist at all? for example, even calling my[1] on the first Bar should trigger the error , but it doesn't.
If we call i.e. High[1], then it does.
so I am interested in the backgrounds of the series - are they (unless given "Infinite" bars lookback) somehow "rotating 250 slots" (with pre-filled zero-values below 0 CurrentBar) ?

Comment