The Range function in ProBuilder language is used to calculate the difference between the highest and lowest prices within a specific bar on a chart. This function is particularly useful for traders and analysts to measure the volatility or the price movement within a single trading period.
Range[N]
Here, N represents the index of the bar relative to the current bar. N can be any integer. Range without an index refers to the current bar.
currentrange = Range
previousrange = Range[1]
IF (currentrange < previousrange AND high < high[1]) THEN
NearPossibleBullishBreakout = 1
ELSE
NearPossibleBullishBreakout = 0
ENDIF
RETURN NearPossibleBullishBreakout
This example demonstrates how to use the Range function to compare the range of the current bar with the range of the previous bar. It also checks if the current high is lower than the previous high. If both conditions are met, it suggests a possible bullish breakout scenario by setting NearPossibleBullishBreakout to 1, otherwise, it sets it to 0.