Definition and Purpose:
The ArrayMax function in ProBuilder language is used to find the maximum value within an array. This function is particularly useful when you need to determine the highest value from a set of data points stored in an array, which is common in data analysis and financial calculations.
ArrayMax($MyArray)
Suppose you have an array of closing prices for a stock over the last 5 days and you want to find the highest closing price in that period. Here’s how you can use ArrayMax:
$prices[1] = 130
$prices[2] = 135
$prices[3] = 128
$prices[4] = 140
$prices[5] = 138
highestPrice = ArrayMax($prices)
In this example, highestPrice will hold the value 140, which is the maximum value in the prices array.
ArrayMax function only works with arrays. Ensure that the variable you pass as an argument is an array.