In NT7, I use a DateTime structure to reset a trade signal on a daily basis using the Time() syntax as follows:
protected override void OnBarUpdate()
{
if (Time[0].DayOfWeek != Time[1].DayOfWeek && Bars.IsFirstBarOfSession)
{
SignalMadeToday = false;
}
.....
Now I'm trying to use the exact same strategy in NT8, but have found an issue with this syntax. When I use this, NT8 throws out "Error on calling 'OnBarUpdate' method on bar 0: You are accessing an index with a value that is invalid since it is out-of-range". To double check this, I used the SampleTimeFilter strategy for NT8, and the same thing happens if I change this;
if (Time[0].DayOfWeek != DayOfWeek.Monday && Time[1].DayOfWeek != DayOfWeek.Friday)
to this
if (Time[0].DayOfWeek != Time[1].DayOfWeek)
So what am I doing wrong? Its almost like NT is using Time() as a barSeries object instead of a barsAgo? It worked fine in NT7, but I can't get NT8 to work with this.
Thanks,
Lee
Comment