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.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
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
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
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
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.