OPEN-SOURCE SCRIPT
Обновлено

Relative Distance to Moving Average

844
This indicator calculates the Relative Distance to a Moving Average (RDMA), a momentum oscillator that measures how overextended a price is from its moving average baseline. It expresses this distance as a percentage, oscillating around a zero line. High positive values may indicate overbought conditions, while large negative values may suggest oversold conditions.

Key Features:

Customizable MA Baseline: The oscillator's baseline is a moving average. Users can select from a wide range of MA types (e.g., EMA, SMA, WMA) and apply volume weighting (Volume weighted) for enhanced responsiveness.

Normalization (Geometric Average): Includes an optional 'Normalize' mode. When enabled, the indicator uses a Geometric Moving Average (GMA) as its baseline and measures the percentage distance from this compound growth average, making it suitable for exponential markets.

Full Divergence Suite (Class A, B, C): The indicator's primary feature is its integrated divergence engine. It automatically detects and plots all three major divergence classes between price and the RDMA:

Regular (A): Signals potential trend exhaustion and reversals.

Hidden (B): Signals potential trend continuations during pullbacks.

Exaggerated (C): Signals weakness at double tops/bottoms.

Divergence Filtering and Visualization:

Price Tolerance Filter: Divergence detection is enhanced with a percentage-based price tolerance (pivPrcTol) to filter out insignificant market noise.

Persistent Visualization: Divergence markers are plotted for the entire duration of the signal and are visually anchored to the RDMA level of the confirming pivot.

Note on Confirmation (Lag): Divergence signals rely on a pivot confirmation method to ensure they do not repaint.

The Start of a- divergence is only detected after the confirming pivot is fully formed (a delay based on Pivot Right Bars).

The End of a divergence is detected either instantly (if the signal is invalidated by price action) or with a delay (when a new, non-divergent pivot is confirmed).

Multi-Timeframe (MTF) Capability:

MTF RDMA Line: The RDMA oscillator itself can be calculated on a higher timeframe, with standard options to handle gaps (Fill Gaps) and prevent repainting (Wait for...).

Limitation: The Divergence detection engine (pivDiv) is disabled if a timeframe other than the chart's timeframe is selected. Divergences are only calculated on the active chart timeframe.

Integrated Alerts: Includes 14 comprehensive alerts for:

The start and end of all 6 divergence types.

The RDMA oscillator crossing the zero line.

DISCLAIMER

For Informational/Educational Use Only: This indicator is provided for informational and educational purposes only. It does not constitute financial, investment, or trading advice, nor is it a recommendation to buy or sell any asset.

Use at Your Own Risk: All trading decisions you make based on the information or signals generated by this indicator are made solely at your own risk.

No Guarantee of Performance: Past performance is not an indicator of future results. The author makes no guarantee regarding the accuracy of the signals or future profitability.

No Liability: The author shall not be held liable for any financial losses or damages incurred directly or indirectly from the use of this indicator.

Signals Are Not Recommendations: The alerts and visual signals (e.g., crossovers) generated by this tool are not direct recommendations to buy or sell. They are technical observations for your own analysis and consideration.
Информация о релизе
2026-01-31 0.2.0
(Mod) Updated libraries LibTmFr, LibMvAv, and LibPvot to their latest versions.
(Mod) Revised 'Normalize' logic: Calculation is now performed entirely in log-space.
(Add) Added 'Pivot Algorithm' input (Fractal, LinReg, Topologic) and 'Threshold' settings.
(Dep) Removed 'Offset' input to streamline the indicator logic.
(Ref) Migrated divergence detection to object-oriented architecture using LibPvot v2.
(Ref) Refactored alert logic to utilize state-aware methods (.hasStarted/.hasEnded).

Отказ от ответственности

Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.