Reputation: 1
Newbie to C#, programming in ninjatrader and i need to develop a simple function that performs the following:
Once the price is no longer increasing the output of the function would need to be the Highest of the high prices in the array.
Thanks to anyone that can help!
Ben
Upvotes: 0
Views: 637
Reputation: 11972
3)
if (High.All(x => currentHighPrice > x)) { ... }
4)
var highest = High.Max();
But both options use LINQ. If that's not an option, just use a for/foreach loop.
Upvotes: 2
Reputation: 10998
Do a foreach loop and check if each item's value is lower than your current value
Upvotes: 0
Reputation: 273691
I think your description is incomplete or incorrect, but currently you're just asking for the Higest (Max) value in an array.
A simple solution :
using System.Linq;
var data = new decimal[10];
decimal m = data.Max();
Upvotes: 1