The DivergenceRSI function in ProBuilder language is designed to identify and return signals of bullish and bearish divergences between a stock’s price and its Relative Strength Index (RSI). Divergences in this context suggest a potential reversal in the current price trend, making this function useful for technical analysis in trading strategies.
DivergenceRSI[RSIperiod, LowRSIthreshold, HighRSIthreshold, Bars](price)
A bullish divergence occurs when the price records new lows while the RSI begins to rise, suggesting a potential upward reversal. Conversely, a bearish divergence happens when the price hits new highs while the RSI declines, indicating a possible downward reversal.
i = DivergenceRSI[5,30,70,20](close)
return i
style(histogram)
This example sets up the DivergenceRSI function with a 5-period RSI, thresholds at 30 (low) and 70 (high), and checks for divergences over the last 20 bars using the closing price. The result is displayed as a histogram.
When using the DivergenceRSI function, ensure that the RSI settings (period and thresholds) match any other RSI indicators on your charts to maintain consistency in your analysis. This function is particularly useful for identifying potential reversals in trend, which can be critical points for making trading decisions.