Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
How to get the highest and lowest value from a group of indicators?
Collapse
X
-
Hello johnnybegoode,
Thanks for your post.
With a defined group of indicators, on each OnBarUpdate() you could assign the indicators current values into an array and then use the Array.Min and Array.Max to determine the values of interest.
This is more of a c# type question than a ninjascript question so I will provide links to internet sources to get you started, you may want to look for further tutorials on C# array.
To get the Min/Max: https://www.dotnetperls.com/max
-
Offhand, I can think of any of 3 ways:Originally posted by johnnybegoode View PostHow to get the highest and lowest value from a group of indicators?
So I have a group of indicators to compare values.
SMA1[0], SMA2[0], SMA3[0], EMA1[0], EMA2[0], EMA3[0]
I would like to reach to this point:
Thank you!Code:If ( (HighestValue - LowestValue) > 0.001) ) { // do this }- Put them in a list; sort the list; use first and last values of the sorted list.
- Put them in a list and use LINQ to get the max and min values
- Use a succession of Math.Max() and Math.Min() operations on the values; do arithmetic on the final results of the operations.
Leave a comment:
-
How to get the highest and lowest value from a group of indicators?
How to get the highest and lowest value from a group of indicators?
So I have a group of indicators to compare values.
SMA1[0], SMA2[0], SMA3[0], EMA1[0], EMA2[0], EMA3[0]
I would like to reach to this point:
Thank you!Code:If ( (HighestValue - LowestValue) > 0.001) ) { // do this }Tags: None
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by CarlTrading, 03-31-2026, 09:41 PM
|
1 response
47 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
23 views
0 likes
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
33 views
1 like
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
51 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
42 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|

Leave a comment: