RSI 7 Dynamic Div | Sand Lines

Overview
RSI 7 Dynamic Div | Sand Lines is a chart-timeframe momentum indicator that combines a configurable RSI, regular and hidden divergence detection, developing LIVE previews, and matching price-chart lines.
Its purpose is to make the relationship between RSI swing structure and price action easier to inspect. Each detected divergence connects two RSI pivot points in the oscillator pane and, optionally, the corresponding price extremes on the main chart. These price connections are called Sand Lines.
“Dynamic” refers to the updating, provisional divergence previews. It does not mean that the RSI length automatically adapts to market conditions. The default RSI period is 7 and remains fixed unless changed in the settings.
This is an analytical indicator, not an automated trading strategy. A divergence identifies a particular relationship between price and RSI; it does not establish that a profitable reversal or continuation will follow.
How the calculations work
The RSI uses RMA-smoothed positive and negative changes in the selected source. Close is the default source. Reference levels are displayed at 30, 50, and 70.
The divergence engine identifies pivots in the RSI itself. For low-side comparisons, it uses the price low of each RSI pivot bar. For high-side comparisons, it uses the price high of each RSI pivot bar. It does not independently locate price pivots and then match them to separate RSI pivots.
Each newly confirmed RSI low is compared with the immediately preceding confirmed RSI low. Each newly confirmed RSI high is compared with the immediately preceding confirmed RSI high. The reference is updated at every confirmed pivot, including pivots that do not produce a divergence. The script does not search every possible pair of older pivots.
Calculations use the current chart timeframe. There are no request.security() calls or built-in higher-timeframe confirmation filters. Changing the chart timeframe recalculates the RSI, pivots, and divergence drawings for the newly selected timeframe.
Four divergence types
Regular bullish — Bull, green by default: the second price low is lower, while the second RSI low is higher.
Regular bearish — Bear, red by default: the second price high is higher, while the second RSI high is lower.
Hidden bullish — H Bull, blue by default: the second price low is higher, while the second RSI low is lower.
Hidden bearish — H Bear, orange by default: the second price high is lower, while the second RSI high is higher.
All comparisons are strict: equal endpoint values do not satisfy a higher-high, lower-low, higher-low, or lower-high condition. Regular and hidden divergence families can be enabled separately.
LIVE previews and confirmed signals
LIVE previews are dashed, partially transparent drawings. They compare the latest confirmed RSI pivot with a developing candidate that meets the left-side pivot requirement but has not completed right-side confirmation. Up to one low-side and one high-side preview can be displayed at the active chart edge.
A LIVE preview can move, change classification, or disappear as the candidate changes. It is an early observation, not a confirmed signal. LIVE previews do not trigger divergence alerts, and their intrabar history is not stored as a historical signal record.
Confirmed divergences are drawn with solid lines only after the required right-side bars have elapsed and the confirmation bar has closed. With the default Pivot Right setting of 5, a pivot on bar 100 can be confirmed at the close of bar 105 if it satisfies the pivot conditions.
The divergence line and its label are positioned on the earlier pivot bars to show the geometry of the comparison. The optional C marker in the RSI pane identifies the later bar on which confirmation actually became available. A historical label on a pivot must not be interpreted as a signal that was known on that pivot bar.
“Confirmed” refers to completion of the pivot-detection rule. It is not confirmation of a future price reversal or continuation.
Sand Lines on the price chart
Each Sand Line connects the price extremes of the same two bars used for the RSI divergence. Bullish divergence lines connect lows; bearish divergence lines connect highs. The price and RSI drawings share their divergence color and classification.
This is a correspondence between two pairs of anchors, not a conversion of RSI values into prices and not a copy of the RSI line's visual angle. For example, regular bullish divergence produces an upward-sloping RSI connection and a downward-sloping price connection. The opposing slopes are the relationship being highlighted.
When extension is enabled, the latest confirmed bullish price line and latest confirmed bearish price line extend to the right. Regular and hidden divergences share their respective bullish or bearish extension slot. Active LIVE price previews can also extend. When a newer confirmed divergence replaces a line in the same direction, the older line becomes a finite segment without moving its original anchors.
These rays can serve as visual references for discretionary price-action analysis. The script does not detect their breaks, count successful touches, validate them as support or resistance, or generate Sand Line breakout alerts. A ray is not automatically removed when price crosses it.
Settings and visual controls
The default configuration is RSI Length 7, Source Close, Pivot Left 5, Pivot Right 5, Range Min 5, and Range Max 60. Regular divergences, hidden divergences, LIVE previews, price lines, labels, confirmation markers, and price-line extension are enabled by default.
The range inputs count bars strictly between the two pivot bars. Therefore, the default 5–60 range permits pivot-to-pivot index separations of 6–61 bars. These settings describe pivot spacing, not the number of bars required for confirmation.
Pivot Left and Pivot Right control the pivot definition. Reducing Pivot Right shortens the required confirmation delay; increasing it requires more subsequent bars before a pivot can be confirmed. Such changes alter which pivots qualify and should not be interpreted as a guarantee of improved signal quality.
An optional moving average is plotted on the RSI. Available choices are None, SMA, SMA + Bollinger Bands, EMA, SMMA (RMA), WMA, and VWMA. The default is SMA with length 14. Bollinger Bands use a default standard-deviation multiplier of 2.0 when that mode is selected. These overlays are visual aids; they do not filter divergence conditions. The 30 and 70 RSI levels are also reference levels, not mandatory divergence thresholds.
Colors and line width are configurable. The default history setting retains 80 confirmed divergence drawings, with an adjustable maximum of 200. Older line and label objects are removed when that limit is exceeded; the C markers are a separate plotted series. Label tooltips show the RSI and price endpoints, and confirmed labels include the confirmation time in UTC.
How to use it
Start by assessing market structure and identifying the price area you want to study. Use a LIVE preview to observe a developing momentum mismatch, not as evidence that a confirmed divergence already exists. When confirmation matters to your process, wait for the solid drawing and the C marker.
Next, inspect both panes. Verify which price extremes and RSI pivots were compared, and distinguish the date of the pivot from the date of confirmation. Use the corresponding Sand Line as a visual reference while applying your own entry, invalidation, and risk-management rules.
For historical review, assess any potential action from the confirmation bar onward, not from the earlier bar carrying the divergence label. Do not judge LIVE behavior from confirmed historical drawings: previews that disappeared are not preserved in that history.
Where it can be useful
The intended use is discretionary study of momentum and swing structure on standard time-based price charts. Suggested applications include examining regular divergence near a price area already identified in your analysis, studying hidden divergence during a pullback within an independently assessed trend, and comparing developing signals with later confirmed structures.
The script does not determine the broader trend or identify support and resistance zones automatically. Those contextual decisions remain external to the indicator.
Intraday and swing-analysis timeframes, such as 15 minutes, 1 hour, 4 hours, and 1 day, are possible starting points for evaluation, not validated recommendations. There is no instrument-specific optimization in the code and no claim that one market or timeframe is universally best. Choose settings through testing on the symbol, timeframe, and trading process you actually use.
Alerts
Five alert conditions are available: Regular Bullish Divergence, Regular Bearish Divergence, Hidden Bullish Divergence, Hidden Bearish Divergence, and Any Confirmed Divergence.
Create the desired alert through TradingView's alert dialog and select Once Per Bar Close. The script's conditions are gated to the closing confirmation update. LIVE previews and Sand Line crossings have no dedicated alert conditions.
Keep Calculate Divergence enabled, along with the divergence families you want to monitor. The Regular Divergences and Hidden Divergences switches affect signal eligibility and alert conditions, not just visual styling. Hiding the price lines or labels does not, by itself, disable confirmed divergence alerts.
TradingView alerts use a saved copy of the script, inputs, symbol, and timeframe from when the alert was created. Recreate an alert after changing those settings or updating the script when you need the alert to use the new configuration.
Limitations and historical behavior
LIVE previews intentionally repaint. Confirmed drawing anchors are not deliberately moved after acceptance, but older rays can stop extending and older drawings can be removed by the retention limit. Changing settings, chart data, or the available calculation history can produce different results. This indicator should not be described simply as “non-repainting.”
The engine checks endpoint relationships between consecutive same-type RSI pivots. It does not require every intervening RSI or price value to remain on one side of the connecting line. It also does not score divergence strength, enforce a minimum price or RSI difference, or apply an automatic trend filter.
The distinctive functionality is the combination of provisional previews, explicit confirmation-time markers, paired RSI/price drawings, and controlled price-ray extension. Standard RSI calculations and conventional divergence definitions are not presented as original inventions.
This indicator does not execute trades, calculate position sizes, or produce strategy performance statistics. Use it as one component of an independently tested analytical process. No profitability, win-rate, or predictive-accuracy claim is made.
RSI 7 Dynamic Div | Sand Lines is a chart-timeframe momentum indicator that combines a configurable RSI, regular and hidden divergence detection, developing LIVE previews, and matching price-chart lines.
Its purpose is to make the relationship between RSI swing structure and price action easier to inspect. Each detected divergence connects two RSI pivot points in the oscillator pane and, optionally, the corresponding price extremes on the main chart. These price connections are called Sand Lines.
“Dynamic” refers to the updating, provisional divergence previews. It does not mean that the RSI length automatically adapts to market conditions. The default RSI period is 7 and remains fixed unless changed in the settings.
This is an analytical indicator, not an automated trading strategy. A divergence identifies a particular relationship between price and RSI; it does not establish that a profitable reversal or continuation will follow.
How the calculations work
The RSI uses RMA-smoothed positive and negative changes in the selected source. Close is the default source. Reference levels are displayed at 30, 50, and 70.
The divergence engine identifies pivots in the RSI itself. For low-side comparisons, it uses the price low of each RSI pivot bar. For high-side comparisons, it uses the price high of each RSI pivot bar. It does not independently locate price pivots and then match them to separate RSI pivots.
Each newly confirmed RSI low is compared with the immediately preceding confirmed RSI low. Each newly confirmed RSI high is compared with the immediately preceding confirmed RSI high. The reference is updated at every confirmed pivot, including pivots that do not produce a divergence. The script does not search every possible pair of older pivots.
Calculations use the current chart timeframe. There are no request.security() calls or built-in higher-timeframe confirmation filters. Changing the chart timeframe recalculates the RSI, pivots, and divergence drawings for the newly selected timeframe.
Four divergence types
Regular bullish — Bull, green by default: the second price low is lower, while the second RSI low is higher.
Regular bearish — Bear, red by default: the second price high is higher, while the second RSI high is lower.
Hidden bullish — H Bull, blue by default: the second price low is higher, while the second RSI low is lower.
Hidden bearish — H Bear, orange by default: the second price high is lower, while the second RSI high is higher.
All comparisons are strict: equal endpoint values do not satisfy a higher-high, lower-low, higher-low, or lower-high condition. Regular and hidden divergence families can be enabled separately.
LIVE previews and confirmed signals
LIVE previews are dashed, partially transparent drawings. They compare the latest confirmed RSI pivot with a developing candidate that meets the left-side pivot requirement but has not completed right-side confirmation. Up to one low-side and one high-side preview can be displayed at the active chart edge.
A LIVE preview can move, change classification, or disappear as the candidate changes. It is an early observation, not a confirmed signal. LIVE previews do not trigger divergence alerts, and their intrabar history is not stored as a historical signal record.
Confirmed divergences are drawn with solid lines only after the required right-side bars have elapsed and the confirmation bar has closed. With the default Pivot Right setting of 5, a pivot on bar 100 can be confirmed at the close of bar 105 if it satisfies the pivot conditions.
The divergence line and its label are positioned on the earlier pivot bars to show the geometry of the comparison. The optional C marker in the RSI pane identifies the later bar on which confirmation actually became available. A historical label on a pivot must not be interpreted as a signal that was known on that pivot bar.
“Confirmed” refers to completion of the pivot-detection rule. It is not confirmation of a future price reversal or continuation.
Sand Lines on the price chart
Each Sand Line connects the price extremes of the same two bars used for the RSI divergence. Bullish divergence lines connect lows; bearish divergence lines connect highs. The price and RSI drawings share their divergence color and classification.
This is a correspondence between two pairs of anchors, not a conversion of RSI values into prices and not a copy of the RSI line's visual angle. For example, regular bullish divergence produces an upward-sloping RSI connection and a downward-sloping price connection. The opposing slopes are the relationship being highlighted.
When extension is enabled, the latest confirmed bullish price line and latest confirmed bearish price line extend to the right. Regular and hidden divergences share their respective bullish or bearish extension slot. Active LIVE price previews can also extend. When a newer confirmed divergence replaces a line in the same direction, the older line becomes a finite segment without moving its original anchors.
These rays can serve as visual references for discretionary price-action analysis. The script does not detect their breaks, count successful touches, validate them as support or resistance, or generate Sand Line breakout alerts. A ray is not automatically removed when price crosses it.
Settings and visual controls
The default configuration is RSI Length 7, Source Close, Pivot Left 5, Pivot Right 5, Range Min 5, and Range Max 60. Regular divergences, hidden divergences, LIVE previews, price lines, labels, confirmation markers, and price-line extension are enabled by default.
The range inputs count bars strictly between the two pivot bars. Therefore, the default 5–60 range permits pivot-to-pivot index separations of 6–61 bars. These settings describe pivot spacing, not the number of bars required for confirmation.
Pivot Left and Pivot Right control the pivot definition. Reducing Pivot Right shortens the required confirmation delay; increasing it requires more subsequent bars before a pivot can be confirmed. Such changes alter which pivots qualify and should not be interpreted as a guarantee of improved signal quality.
An optional moving average is plotted on the RSI. Available choices are None, SMA, SMA + Bollinger Bands, EMA, SMMA (RMA), WMA, and VWMA. The default is SMA with length 14. Bollinger Bands use a default standard-deviation multiplier of 2.0 when that mode is selected. These overlays are visual aids; they do not filter divergence conditions. The 30 and 70 RSI levels are also reference levels, not mandatory divergence thresholds.
Colors and line width are configurable. The default history setting retains 80 confirmed divergence drawings, with an adjustable maximum of 200. Older line and label objects are removed when that limit is exceeded; the C markers are a separate plotted series. Label tooltips show the RSI and price endpoints, and confirmed labels include the confirmation time in UTC.
How to use it
Start by assessing market structure and identifying the price area you want to study. Use a LIVE preview to observe a developing momentum mismatch, not as evidence that a confirmed divergence already exists. When confirmation matters to your process, wait for the solid drawing and the C marker.
Next, inspect both panes. Verify which price extremes and RSI pivots were compared, and distinguish the date of the pivot from the date of confirmation. Use the corresponding Sand Line as a visual reference while applying your own entry, invalidation, and risk-management rules.
For historical review, assess any potential action from the confirmation bar onward, not from the earlier bar carrying the divergence label. Do not judge LIVE behavior from confirmed historical drawings: previews that disappeared are not preserved in that history.
Where it can be useful
The intended use is discretionary study of momentum and swing structure on standard time-based price charts. Suggested applications include examining regular divergence near a price area already identified in your analysis, studying hidden divergence during a pullback within an independently assessed trend, and comparing developing signals with later confirmed structures.
The script does not determine the broader trend or identify support and resistance zones automatically. Those contextual decisions remain external to the indicator.
Intraday and swing-analysis timeframes, such as 15 minutes, 1 hour, 4 hours, and 1 day, are possible starting points for evaluation, not validated recommendations. There is no instrument-specific optimization in the code and no claim that one market or timeframe is universally best. Choose settings through testing on the symbol, timeframe, and trading process you actually use.
Alerts
Five alert conditions are available: Regular Bullish Divergence, Regular Bearish Divergence, Hidden Bullish Divergence, Hidden Bearish Divergence, and Any Confirmed Divergence.
Create the desired alert through TradingView's alert dialog and select Once Per Bar Close. The script's conditions are gated to the closing confirmation update. LIVE previews and Sand Line crossings have no dedicated alert conditions.
Keep Calculate Divergence enabled, along with the divergence families you want to monitor. The Regular Divergences and Hidden Divergences switches affect signal eligibility and alert conditions, not just visual styling. Hiding the price lines or labels does not, by itself, disable confirmed divergence alerts.
TradingView alerts use a saved copy of the script, inputs, symbol, and timeframe from when the alert was created. Recreate an alert after changing those settings or updating the script when you need the alert to use the new configuration.
Limitations and historical behavior
LIVE previews intentionally repaint. Confirmed drawing anchors are not deliberately moved after acceptance, but older rays can stop extending and older drawings can be removed by the retention limit. Changing settings, chart data, or the available calculation history can produce different results. This indicator should not be described simply as “non-repainting.”
The engine checks endpoint relationships between consecutive same-type RSI pivots. It does not require every intervening RSI or price value to remain on one side of the connecting line. It also does not score divergence strength, enforce a minimum price or RSI difference, or apply an automatic trend filter.
The distinctive functionality is the combination of provisional previews, explicit confirmation-time markers, paired RSI/price drawings, and controlled price-ray extension. Standard RSI calculations and conventional divergence definitions are not presented as original inventions.
This indicator does not execute trades, calculate position sizes, or produce strategy performance statistics. Use it as one component of an independently tested analytical process. No profitability, win-rate, or predictive-accuracy claim is made.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.