OPEN-SOURCE SCRIPT
Source-Aligned Oscillators (for Divergences)

A simple tool to visualize oscillators on different price sources — and fix one of the most common divergence mistakes.
Many traders look for divergence by comparing:
This creates a hidden inconsistency.
Oscillators such as Relative Strength Index, momentum, or ROC are typically built using close-to-close data.
But when divergence is drawn using wick extremes (highs/lows), you are no longer comparing the same type of information.
This becomes especially problematic on large candles:
👉 This often produces “fake” or misleading divergence signals.
The idea behind this script
Divergence should ideally be evaluated using aligned data sources:
This script allows you to do exactly that.
What this tool does
Displays a single oscillator at a time for clarity
Supports multiple oscillators:
Lets you compute them on different sources:
High / Low split mode (key feature)
Instead of forcing one source, this mode shows:
This helps you clearly see how oscillators behave when aligned with actual price extremes — instead of mixing closes with wicks.
How to use it
Final note
This tool does not generate divergence signals automatically.
Its purpose is to help you see divergence correctly, with consistent data.
Because sometimes the issue is not the market — it is how we measure it.
Many traders look for divergence by comparing:
- price → using highs and lows
- oscillators (like RSI) → calculated on close
This creates a hidden inconsistency.
Oscillators such as Relative Strength Index, momentum, or ROC are typically built using close-to-close data.
But when divergence is drawn using wick extremes (highs/lows), you are no longer comparing the same type of information.
This becomes especially problematic on large candles:
- the distance between low and close (or high and close) can be significant
- price may print a new low via a wick
- while the close — and therefore the oscillator — shows little real change
👉 This often produces “fake” or misleading divergence signals.
The idea behind this script
Divergence should ideally be evaluated using aligned data sources:
- if your oscillator is based on closes → compare it to close-based structure
- if you want to use highs/lows → then the oscillator should reflect those extremes too
This script allows you to do exactly that.
What this tool does
Displays a single oscillator at a time for clarity
Supports multiple oscillators:
- RSI
- ROC
- Momentum
- MACD Histogram
- CMO
- Stochastic RSI
Lets you compute them on different sources:
- Close
- HL2
- HLC3
- OHLC4
- Candle body split (open/close extremes)
- High / Low split
High / Low split mode (key feature)
Instead of forcing one source, this mode shows:
- oscillator calculated on lows → useful for bullish structure
- oscillator calculated on highs → useful for bearish structure
This helps you clearly see how oscillators behave when aligned with actual price extremes — instead of mixing closes with wicks.
How to use it
- Switch between sources and observe how oscillator structure changes
- Compare close-based vs wick-based behavior
- Identify whether a divergence is:
- structurally meaningful
- or simply caused by a single candle wick
Final note
This tool does not generate divergence signals automatically.
Its purpose is to help you see divergence correctly, with consistent data.
Because sometimes the issue is not the market — it is how we measure it.
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
Quant Developer | Pine Script v6 | Python & R
12+ yrs system. trading, hedge fund experience
Indicators, strategies & screeners
Futures & options
💼 Hire/Consulting:
qntly.com/hire
🎓 Pine Code With AI:
qntly.com/pineai
12+ yrs system. trading, hedge fund experience
Indicators, strategies & screeners
Futures & options
💼 Hire/Consulting:
qntly.com/hire
🎓 Pine Code With AI:
qntly.com/pineai
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
Quant Developer | Pine Script v6 | Python & R
12+ yrs system. trading, hedge fund experience
Indicators, strategies & screeners
Futures & options
💼 Hire/Consulting:
qntly.com/hire
🎓 Pine Code With AI:
qntly.com/pineai
12+ yrs system. trading, hedge fund experience
Indicators, strategies & screeners
Futures & options
💼 Hire/Consulting:
qntly.com/hire
🎓 Pine Code With AI:
qntly.com/pineai
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。