Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Maximum Bars Lookback
Collapse
X
-
NT 7 not as clean as NT 6.5
I have explored the problem and found an explanation. There was a bug in the indicator, which in some cases prevented that a value was written to the DateTimeSeries. In such a case NT7 behaves in a different way than NT 6.5. This can be shown with the following simple indicator, which prints the result to the output window:
#region Variables
private DateTimeSeries someDate;
#endregion
protected override void Initialize()
{
someDate = new DateTimeSeries(this);
}
protected override void OnBarUpdate()
{
if ( Time[0].DayOfWeek == DayOfWeek.Monday)
someDate.Set(Time[0]);
Print (CurrentBar + " " + Convert.ToString(someDate[0]));
}
With this indicator, values are written to the DateTimeSeries only on Monday. Nothing is written to the DateTimeSeries for the other days. So what happens?
NT 6.5. -> On Mondays the DateTimeSeries contains the affected values, on all other days the DateTimeSeries contains the default value "01.01.0001 00:00:00".
NT 7.0.0.13 set to "TwoHundredFiftySix" -> On Mondays the DateTimeSeries contains the affected values, on all other days the DateTimeSeries contains either "01.01.0001 00:00:00" or random values from prior fields of the DateTimeSeries.
NT 7.0.0.13 set set to "MaximumBarsLookBack.Infinite" via indicator dialogue -> "Error on calling 'OnBarUpdate' method for indicator 'Test' on bar 0: You are accessing an index with a value that is invalid since its out of range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart."
Conclusion: If you do not affect a value to the DateTimeSeries,
- NT 6.5. writes the default value
- NT 7 (TwoHundredFiftySix) writes random values
- NT7 (Infinite) creates an out-of-range exception.
I don't think that the solution adopted for NT is really clean here.
Last edited by Harry; 04-03-2010, 12:35 PM.
Comment
-
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by CarlTrading, 03-31-2026, 09:41 PM
|
1 response
81 views
1 like
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
41 views
0 likes
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
64 views
2 likes
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
66 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
54 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|

Comment