int daysBackStart = 7; int daysBackFinish = 3; DateTime today = DateTime.Now; DateTime beginDay = today.AddDays(-1*daysBackStart); DateTime endDay = today.AddDays(-1*daysBackFinish); // OnBarUpdate int startBar = CurrentBar - Bars.GetBar(beginDay); int endBar = CurrentBar - Bars.GetBar(endDay); int fromBar = startBar+10; double myMax = MAX(High,10)[fromBar]; // if fromBar < 0 i have exception "needed to be between 0 and 34100 but was -47 error."
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
MAX problem
Collapse
X
-
MAX problem
Hello i'm check my indicator on HISTORY and i got the problem with MAX().
In NT7 all works fine. Why in NT8 i can't count MAX with "fromBar < 0"?Code:Last edited by nordseven; 01-31-2017, 07:28 AM.Tags: None
-
Hello Nordseven,
Thank you for your note.
Passing a negative index in NT7 worked but was not supported. In NT8 it neither works nor is supported. A negative index value only works historically and never in live data.
Please let us know if you need further assistance.Alan P.NinjaTrader Customer Service
-
Hello Nordseven,
Passing a negative value as a bar index in NT8 is not supported.
I would suggest checking to make sure the bar index value is not negative.
So prior to,
double myMax = MAX(High,10)[fromBar];
You could add,
if(fromBar<0) return;
Please let us know if you need further assistance.Alan P.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by CarlTrading, 03-31-2026, 09:41 PM
|
1 response
142 views
1 like
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
81 views
1 like
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
125 views
2 likes
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
120 views
1 like
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
98 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|

Comment