OPEN-SOURCE SCRIPT

RSI Divergence Momentum Engine

449
RSI Divergence Momentum Engine

RSI Divergence Momentum Engine is a momentum and divergence analysis tool based on the Relative Strength Index. It is designed to help users study RSI trend tone, overbought / oversold behavior, RSI signal-line interaction, regular divergence, hidden divergence, and price-structure confirmation.

The script combines RSI with a signal moving average, pivot-based divergence detection, ADX trend-strength filtering, RSI trend-lock logic, gap protection, and a price-structure score. The goal is to reduce weak divergence interpretation and provide a more structured view of momentum reversal and continuation conditions.

It does not provide buy or sell recommendations. The purpose of this script is to help users analyze RSI momentum behavior, divergence quality, trend context, and structure alignment.

────────────────────
Core Concept
────────────────────

RSI is a momentum oscillator that measures the speed and magnitude of recent price changes.

A high RSI reading can show strong upside momentum or overbought pressure.

A low RSI reading can show strong downside momentum or oversold pressure.

Divergence occurs when price and RSI move in different structural directions.

A bullish regular divergence occurs when price makes a lower low while RSI forms a higher low.

A bearish regular divergence occurs when price makes a higher high while RSI forms a lower high.

Hidden divergence can be used to study potential continuation behavior inside an existing trend.

This script focuses on four main ideas:

• RSI momentum tone
• RSI signal-line interaction
• regular and hidden divergence
• divergence quality filtering through structure, ADX, and trend context

────────────────────
What This Script Shows
────────────────────

The script can display:

• RSI line
• RSI signal moving average
• RSI / signal fill
• overbought and oversold zones
• RSI middle level
• momentum tone ribbon
• bullish divergence labels
• bearish divergence labels
• hidden divergence labels
• divergence lines
• optional divergence zones
• RSI 50 recovery / loss markers
• RSI signal moving average crossover markers
• overbought / oversold event markers
• confidence percentage
• strength grade markers

These elements are intended to help users review whether RSI momentum is confirming, weakening, diverging, or aligning with price structure.

────────────────────
How It Works
────────────────────

1. The script calculates RSI from the selected source and length.
2. A configurable signal moving average is applied to the RSI.
3. RSI tone is classified by comparing RSI with the middle level and its signal line.
4. Overbought, oversold, and middle reference levels are plotted.
5. Pivot lows and pivot highs are detected on the RSI.
6. Price pivots and RSI pivots are compared to detect regular divergence.
7. Optional hidden divergence can also be detected.
8. Divergence distance and RSI gap filters help reduce very small or crowded signals.
9. ADX filtering checks whether the market has enough trend strength for the divergence context.
10. Trend-lock logic can block counter-trend divergence when RSI remains in a strong trend state.
11. Gap protection can reduce counter-direction signals immediately after strong gap movement.
12. A price-structure score checks EMA, VWAP, swing, and reversal-candle alignment.
13. A confidence score is calculated from ADX, structure score, RSI extreme location, divergence gap, and gap-protection context.
14. The script assigns weak, normal, or strong divergence grades based on the selected thresholds.

This structure is intended to make RSI divergence interpretation more selective than a simple pivot-to-pivot comparison.

────────────────────
Inputs And Customization
────────────────────

Users can adjust:

• RSI source
• RSI length
• RSI signal moving average length
• RSI signal moving average type
• overbought level
• oversold level
• middle level
• signal mode
• RSI 50 cross confirmation window
• RSI / signal gap requirement
• divergence pivot length
• minimum and maximum pivot distance
• minimum RSI divergence gap
• divergence line visibility
• hidden divergence visibility
• divergence cooldown
• strength grading thresholds
• confidence percentage visibility
• ADX filter settings
• trend-lock settings
• gap-protection settings
• price-structure score settings
• trend EMA filter
• volume filter
• RSI extreme filter
• RSI background zones
• RSI signal fill
• momentum tone ribbon
• guide labels

The default settings are designed to focus on clearer RSI divergence structures while reducing weak signals from noisy pivots, trend conflicts, and poor structure alignment.

────────────────────
Visual Elements
────────────────────

The script includes:

• RSI line
• RSI Signal MA
• RSI Signal Fill
• Overbought Zone
• Oversold Zone
• Middle Line
• Momentum Tone Ribbon
• Bull divergence label
• Bear divergence label
• Hidden Bull label
• Hidden Bear label
• Divergence line
• Optional divergence zone
• RSI+ marker
• RSI- marker
• MA cross marker
• OB / OS marker

The RSI line changes color according to bullish, bearish, or neutral momentum tone.

The fill between RSI and the signal moving average helps show short-term RSI pressure.

The momentum tone ribbon gives a compact view of whether RSI is above or below its signal and middle level.

The divergence labels show the detected direction, strength grade, and optional confidence percentage.

────────────────────
Reference Markers
────────────────────

Bull:
Shows a regular bullish RSI divergence.

Bear:
Shows a regular bearish RSI divergence.

H-Bull:
Shows a hidden bullish divergence.

H-Bear:
Shows a hidden bearish divergence.

RSI+:
Shows a stronger RSI recovery above the middle level.

RSI-:
Shows a stronger RSI loss below the middle level.

MA↑:
Shows RSI crossing above its signal moving average.

MA↓:
Shows RSI crossing below its signal moving average.

OB:
Shows RSI crossing into the overbought zone.

OS:
Shows RSI crossing into the oversold zone.

These markers are not trading signals. They are visual references for studying RSI momentum, divergence quality, and trend context.

────────────────────
How To Use
────────────────────

Use this script as an RSI momentum and divergence analysis tool.

General interpretation examples:

• A bullish divergence can help users review whether downside price movement is losing RSI momentum.
• A bearish divergence can help users review whether upside price movement is losing RSI momentum.
• A stronger divergence grade can indicate that the event satisfied more ADX, structure, RSI extreme, and divergence-gap conditions.
• RSI+ can help users review when RSI recovers above the middle level with strength.
• RSI- can help users review when RSI loses the middle level with weakness.
• Hidden divergence can be used to study potential continuation behavior, especially when aligned with trend context.
• The RSI signal moving average can help users review short-term momentum shifts.
• The momentum tone ribbon can help users quickly read bullish, bearish, or neutral RSI pressure.

This script is best reviewed together with price action, support and resistance, volatility, trend structure, and higher-timeframe context.

────────────────────
Confirmation And Repainting Notes
────────────────────

This script uses RSI pivot highs and pivot lows.

Pivot-based divergence requires bars on both sides of the RSI turning point before the pivot is confirmed.

Because of this, divergence labels and divergence lines appear only after the relevant pivot is confirmed.

If realtime mode is used, some signal conditions may change before candle close.

For more conservative use, users can select bar-close confirmation and evaluate signals after candle close.

The script does not use future price data to predict market direction. However, pivot-based structures naturally require confirmation bars, so divergence markers are confirmed after the pivot has formed.

────────────────────
Limitations
────────────────────

This script does not predict future price movement.

It does not provide buy or sell recommendations.

RSI divergence does not guarantee reversal.

Hidden divergence does not guarantee continuation.

RSI can remain overbought or oversold during strong trends.

Divergence signals can be less reliable in low-volatility ranges, fast news-driven moves, or unstable market conditions.

The confidence score is a structural reference, not a probability of profit.

This script should not be used as a standalone trading system.

────────────────────
Disclaimer
────────────────────

This publication is for educational and informational chart analysis only.

It does not constitute financial advice, investment advice, or a recommendation to buy or sell any financial instrument.

All trading and investment decisions are the responsibility of the user.

━━━━━━━━━━━━━━━━━━━━

RSI Divergence Momentum Engine

RSI Divergence Momentum Engine은 Relative Strength Index를 기반으로 한 모멘텀 및 다이버전스 분석 보조지표입니다. RSI 추세 톤, 과매수 / 과매도 행동, RSI 시그널선 상호작용, 일반 다이버전스, 히든 다이버전스, 가격 구조 확인을 함께 분석할 수 있도록 설계되었습니다.

이 스크립트는 RSI와 시그널 이동평균, 피벗 기반 다이버전스 감지, ADX 추세 강도 필터, RSI 트렌드 락 로직, 갭 보호, 가격 구조 점수를 결합합니다. 목적은 약한 다이버전스 해석을 줄이고, 모멘텀 반전과 지속 조건을 더 구조적으로 확인하는 것입니다.

이 지표는 매수 또는 매도 추천을 제공하지 않습니다. 목적은 RSI 모멘텀 행동, 다이버전스 품질, 추세 컨텍스트, 구조 정렬을 분석하는 것입니다.

────────────────────
핵심 개념
────────────────────

RSI는 최근 가격 변화의 속도와 크기를 측정하는 모멘텀 오실레이터입니다.

높은 RSI 값은 강한 상승 모멘텀 또는 과매수 압력을 보여줄 수 있습니다.

낮은 RSI 값은 강한 하락 모멘텀 또는 과매도 압력을 보여줄 수 있습니다.

다이버전스는 가격과 RSI가 서로 다른 구조적 방향으로 움직일 때 발생합니다.

상승 일반 다이버전스는 가격이 더 낮은 저점을 만들지만 RSI는 더 높은 저점을 만들 때 발생합니다.

하락 일반 다이버전스는 가격이 더 높은 고점을 만들지만 RSI는 더 낮은 고점을 만들 때 발생합니다.

히든 다이버전스는 기존 추세 안에서 잠재적인 지속 행동을 관찰하는 데 사용할 수 있습니다.

이 스크립트는 네 가지 핵심 개념에 초점을 둡니다.

• RSI 모멘텀 톤
• RSI 시그널선 상호작용
• 일반 및 히든 다이버전스
• 구조, ADX, 추세 컨텍스트를 통한 다이버전스 품질 필터링

────────────────────
이 스크립트가 보여주는 것
────────────────────

이 스크립트는 다음 요소를 표시할 수 있습니다.

• RSI 라인
• RSI 시그널 이동평균
• RSI / 시그널 fill
• 과매수 및 과매도 구간
• RSI 중앙선
• 모멘텀 톤 리본
• 상승 다이버전스 라벨
• 하락 다이버전스 라벨
• 히든 다이버전스 라벨
• 다이버전스 라인
• 선택 가능한 다이버전스 존
• RSI 50선 회복 / 이탈 마커
• RSI 시그널 이동평균 교차 마커
• 과매수 / 과매도 이벤트 마커
• 신뢰도 퍼센트
• 강도 등급 마커

이 요소들은 RSI 모멘텀이 가격을 확인하는지, 약해지는지, 다이버전스를 형성하는지, 또는 가격 구조와 정렬되는지를 복기할 수 있도록 돕습니다.

────────────────────
작동 방식
────────────────────

1. 선택한 소스와 길이를 기준으로 RSI를 계산합니다.
2. 설정 가능한 시그널 이동평균을 RSI에 적용합니다.
3. RSI를 중앙선 및 시그널선과 비교해 모멘텀 톤을 분류합니다.
4. 과매수, 과매도, 중앙 기준선을 표시합니다.
5. RSI의 피벗 저점과 피벗 고점을 감지합니다.
6. 가격 피벗과 RSI 피벗을 비교해 일반 다이버전스를 감지합니다.
7. 선택적으로 히든 다이버전스도 감지할 수 있습니다.
8. 피벗 거리와 RSI gap 필터를 사용해 너무 작거나 밀집된 신호를 줄입니다.
9. ADX 필터는 다이버전스 컨텍스트에 충분한 추세 강도가 있는지 확인합니다.
10. 트렌드 락 로직은 RSI가 강한 추세 상태를 유지할 때 역추세 다이버전스를 차단할 수 있습니다.
11. 갭 보호 로직은 강한 갭 움직임 직후 반대 방향 신호를 줄일 수 있습니다.
12. 가격 구조 점수는 EMA, VWAP, 스윙, 반전 캔들 정렬을 확인합니다.
13. ADX, 구조 점수, RSI 극단 위치, 다이버전스 gap, 갭 보호 컨텍스트를 기반으로 신뢰도 점수를 계산합니다.
14. 선택한 기준에 따라 약함, 보통, 강함 등급을 부여합니다.

이 구조는 단순한 피벗 비교보다 더 선별적인 RSI 다이버전스 해석을 목표로 합니다.

────────────────────
입력값 및 설정
────────────────────

사용자는 다음 항목을 조정할 수 있습니다.

• RSI source
• RSI length
• RSI signal moving average length
• RSI signal moving average type
• overbought level
• oversold level
• middle level
• signal mode
• RSI 50 cross confirmation window
• RSI / signal gap requirement
• divergence pivot length
• minimum and maximum pivot distance
• minimum RSI divergence gap
• divergence line visibility
• hidden divergence visibility
• divergence cooldown
• strength grading thresholds
• confidence percentage visibility
• ADX filter settings
• trend-lock settings
• gap-protection settings
• price-structure score settings
• trend EMA filter
• volume filter
• RSI extreme filter
• RSI background zones
• RSI signal fill
• momentum tone ribbon
• guide labels

기본 설정은 노이즈성 피벗, 추세 충돌, 구조 정렬이 부족한 약한 신호를 줄이면서 더 명확한 RSI 다이버전스 구조에 집중하도록 설계되어 있습니다.

────────────────────
시각 요소
────────────────────

이 스크립트는 다음 시각 요소를 포함합니다.

• RSI line
• RSI Signal MA
• RSI Signal Fill
• Overbought Zone
• Oversold Zone
• Middle Line
• Momentum Tone Ribbon
• Bull divergence label
• Bear divergence label
• Hidden Bull label
• Hidden Bear label
• Divergence line
• Optional divergence zone
• RSI+ marker
• RSI- marker
• MA cross marker
• OB / OS marker

RSI 라인은 상승, 하락, 중립 모멘텀 톤에 따라 색상이 바뀝니다.

RSI와 시그널 이동평균 사이의 fill은 단기 RSI 압력을 보여줍니다.

모멘텀 톤 리본은 RSI가 시그널선과 중앙선 위 또는 아래에 있는지 빠르게 확인하는 데 도움을 줍니다.

다이버전스 라벨은 감지된 방향, 강도 등급, 선택 가능한 신뢰도 퍼센트를 표시합니다.

────────────────────
참고 마커
────────────────────

Bull:
일반 상승 RSI 다이버전스를 표시합니다.

Bear:
일반 하락 RSI 다이버전스를 표시합니다.

H-Bull:
히든 상승 다이버전스를 표시합니다.

H-Bear:
히든 하락 다이버전스를 표시합니다.

RSI+:
RSI가 중앙선 위로 강하게 회복되는 구간을 표시합니다.

RSI-:
RSI가 중앙선 아래로 약하게 이탈하는 구간을 표시합니다.

MA↑:
RSI가 시그널 이동평균을 상향 돌파하는 구간을 표시합니다.

MA↓:
RSI가 시그널 이동평균을 하향 이탈하는 구간을 표시합니다.

OB:
RSI가 과매수 구간으로 진입하는 구간을 표시합니다.

OS:
RSI가 과매도 구간으로 진입하는 구간을 표시합니다.

이 마커들은 매매 신호가 아닙니다. RSI 모멘텀, 다이버전스 품질, 추세 컨텍스트를 관찰하기 위한 시각적 참고 지점입니다.

────────────────────
사용 방법
────────────────────

이 스크립트는 RSI 모멘텀 및 다이버전스 분석 도구로 사용하는 것이 적절합니다.

일반적인 해석 예시는 다음과 같습니다.

• 상승 다이버전스는 가격 하락 움직임에서 RSI 모멘텀이 약해지고 있는지 확인하는 데 사용할 수 있습니다.
• 하락 다이버전스는 가격 상승 움직임에서 RSI 모멘텀이 약해지고 있는지 확인하는 데 사용할 수 있습니다.
• 더 강한 다이버전스 등급은 ADX, 구조, RSI 극단 위치, divergence gap 조건을 더 많이 충족했다는 의미일 수 있습니다.
• RSI+는 RSI가 중앙선을 강하게 회복하는 구간을 복기하는 데 사용할 수 있습니다.
• RSI-는 RSI가 중앙선을 약하게 이탈하는 구간을 복기하는 데 사용할 수 있습니다.
• 히든 다이버전스는 특히 추세 컨텍스트와 정렬될 때 잠재적인 지속 행동을 분석하는 데 사용할 수 있습니다.
• RSI 시그널 이동평균은 단기 모멘텀 전환을 확인하는 데 사용할 수 있습니다.
• 모멘텀 톤 리본은 상승, 하락, 중립 RSI 압력을 빠르게 읽는 데 도움을 줄 수 있습니다.

이 스크립트는 가격 행동, 지지와 저항, 변동성, 추세 구조, 상위 시간대 컨텍스트와 함께 검토하는 것이 좋습니다.

────────────────────
확인봉 및 리페인트 안내
────────────────────

이 스크립트는 RSI 피벗 고점과 피벗 저점을 사용합니다.

피벗 기반 다이버전스는 RSI 전환점의 양쪽에 일정 수의 봉이 형성되어야 확정됩니다.

따라서 다이버전스 라벨과 라인은 관련 피벗이 확정된 이후에만 표시됩니다.

Realtime 모드를 사용할 경우 일부 신호 조건은 봉 마감 전까지 변경될 수 있습니다.

보다 보수적인 사용을 원한다면 Bar Close Confirmed 모드를 선택하고 봉 마감 이후 신호를 확인하는 것이 적절합니다.

이 스크립트는 미래 가격 데이터를 사용해 시장 방향을 예측하지 않습니다. 다만 피벗 기반 구조는 확인봉이 필요하므로 다이버전스 마커는 피벗이 형성된 뒤 확정됩니다.

────────────────────
한계
────────────────────

이 스크립트는 미래 가격 움직임을 예측하지 않습니다.

매수 또는 매도 추천을 제공하지 않습니다.

RSI 다이버전스는 반전을 보장하지 않습니다.

히든 다이버전스는 추세 지속을 보장하지 않습니다.

강한 추세에서는 RSI가 장시간 과매수 또는 과매도 상태에 머무를 수 있습니다.

저변동성 횡보, 뉴스성 급변, 불안정한 시장 환경에서는 다이버전스 신호의 신뢰도가 낮아질 수 있습니다.

신뢰도 점수는 구조적 참고값이지 수익 확률이 아닙니다.

이 스크립트를 단독 매매 시스템으로 사용해서는 안 됩니다.

────────────────────
중요 고지
────────────────────

본 게시물은 교육 및 정보 제공 목적의 차트 분석 자료입니다.

투자 자문, 매수·매도 추천, 특정 금융상품 거래 권유를 의미하지 않습니다.

모든 투자 판단과 그 결과에 대한 책임은 이용자 본인에게 있습니다.

Aviso legal

As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.