HighestBars is a function in the ProBuilder language used to determine the position of the highest value within a specified period of past data. This function is particularly useful in financial chart analysis, helping to identify the peak value of a data series like price or volume over a given range.
HighestBars[Period](source)
The Period specifies the number of past bars to consider, and source indicates the data series (such as close, high, low, etc.). The function returns the offset (number of bars back) to the bar with the highest value. If no highest value is found within the specified period, it returns -1.
myHighest = HighestBars[10](close)
IF myHighest > 0 THEN
DRAWTEXT("Highest close in last 10 bars", barindex - myHighest, close[myHighest])
ENDIF
In this example, HighestBars[10](close) checks for the highest closing price in the last 10 bars. If a highest value is found at least 1 bar ago (i.e., myHighest is superior to 0), it draws a text label at the bar where the highest close occurred.
This function is essential for traders and analysts who need to pinpoint significant peaks in price or other data series over a specified timeframe, aiding in the decision-making process related to trading strategies.