PROTECTED SOURCE SCRIPT
RSI Divergence Filtered by ZigZag Ratios

RSI Divergence Filtered by ZigZag Ratios
This indicator is designed to help traders identify potential trend reversals by finding RSI divergence and then confirming it with a unique filter based on price movements. It draws two ZigZag lines on your chart to visually represent these patterns.
Core Functionality
The indicator works by doing three main things:
Price ZigZag (Blue Line): ZigZag line directly on the price chart. This line connects the significant high and low points of the price action, based on the ZigZag Deviation % you set. It's a way to simplify the trend and clearly see the "legs" or swings of the market.
RSI ZigZag (Orange Line): It also draws a separate ZigZag line, colored orange, that follows the movement of the RSI indicator. This helps you visually track the highs and lows of the RSI at the same time as the price.
Divergence Detection: The indicator continuously looks for divergence between the price ZigZag and the RSI.
The Key Filter: ZigZag Ratio
This is what makes the indicator unique. When a potential divergence is found, it doesn't just display a signal immediately. It performs an extra check:
It compares the size of the most recent price swing (the "last leg") to the size of the previous swing in the same direction. It then calculates a ratio. If the most recent swing is significantly smaller than the previous one, it confirms the signal and displays a label.
This filtering mechanism aims to weed out weak signals and highlight divergences that occur after a period of slowing momentum.
Bullish/Bearish Div Labels: When a valid, filtered divergence is found, the indicator will place a green Bullish Div label at the bottom of a low swing or a red Bearish Div label at the top of a high swing.
User Inputs
ZigZag Deviation %: This is the minimum percentage change required to form a new ZigZag pivot. The default value is set to 0.3618, which is a popular number in technical analysis. A lower value will capture more minor swings, while a higher value will focus only on larger, more significant ones.
RSI Length: The number of bars used to calculate the RSI. The default is 6, but you can adjust this to your preference.
This indicator is designed to help traders identify potential trend reversals by finding RSI divergence and then confirming it with a unique filter based on price movements. It draws two ZigZag lines on your chart to visually represent these patterns.
Core Functionality
The indicator works by doing three main things:
Price ZigZag (Blue Line): ZigZag line directly on the price chart. This line connects the significant high and low points of the price action, based on the ZigZag Deviation % you set. It's a way to simplify the trend and clearly see the "legs" or swings of the market.
RSI ZigZag (Orange Line): It also draws a separate ZigZag line, colored orange, that follows the movement of the RSI indicator. This helps you visually track the highs and lows of the RSI at the same time as the price.
Divergence Detection: The indicator continuously looks for divergence between the price ZigZag and the RSI.
The Key Filter: ZigZag Ratio
This is what makes the indicator unique. When a potential divergence is found, it doesn't just display a signal immediately. It performs an extra check:
It compares the size of the most recent price swing (the "last leg") to the size of the previous swing in the same direction. It then calculates a ratio. If the most recent swing is significantly smaller than the previous one, it confirms the signal and displays a label.
This filtering mechanism aims to weed out weak signals and highlight divergences that occur after a period of slowing momentum.
Bullish/Bearish Div Labels: When a valid, filtered divergence is found, the indicator will place a green Bullish Div label at the bottom of a low swing or a red Bearish Div label at the top of a high swing.
User Inputs
ZigZag Deviation %: This is the minimum percentage change required to form a new ZigZag pivot. The default value is set to 0.3618, which is a popular number in technical analysis. A lower value will capture more minor swings, while a higher value will focus only on larger, more significant ones.
RSI Length: The number of bars used to calculate the RSI. The default is 6, but you can adjust this to your preference.
Skrip dilindungi
Skrip ini diterbitkan sebagai sumber tertutup. Akan tetapi, anda boleh menggunakannya dengan percuma dan tanpa had – ketahui lebih lanjut di sini.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Skrip dilindungi
Skrip ini diterbitkan sebagai sumber tertutup. Akan tetapi, anda boleh menggunakannya dengan percuma dan tanpa had – ketahui lebih lanjut di sini.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.