The MAX function in ProBuilder language is a mathematical function used to determine the maximum value between two given values or variables. This function is particularly useful in scenarios where you need to compare two data points and use the larger of the two for further calculations or analysis.
MAX(a, b)
Where a and b are the two values or variables to be compared.
mmA = average[20](high)
mmB = average[50](high)
result = MAX(mmA, mmB)
RETURN result
In this example, mmA is the 20-period moving average of the high prices, and mmB is the 50-period moving average of the high prices. The MAX function compares these two averages and assigns the greater value to the variable result, which is then returned.
Understanding the use of the MAX function can help in creating more dynamic and condition-responsive trading algorithms.