OPEN-SOURCE SCRIPT

Reactive Curvature Smoother Moving Average Indicator

204
Summary in one paragraph
RCS MA is a reactive curvature smoother for any liquid instrument on intraday through swing timeframes. It helps you act only when context strengthens by adapting its window length with a normalized path energy score and by smoothing with robust residual weights over a quadratic fit, then optionally blending a capped one step forecast. Add it to a clean chart and watch the single colored line. Shapes can shift while a bar forms and settle on close. For conservative use, judge on bar close.

Scope and intent
• Markets: major FX pairs, index futures, large cap equities, liquid crypto
• Timeframes: one minute to daily
• Purpose: reduce lag in trends while resisting chop and outliers
• Limits: indicator only, no orders

Originality and usefulness

• Novelty: adaptive window selection by minimizing normalized path energy with directionality bias, plus Huber weighted residuals and curvature aware penalty, finished with a mintick capped forecast blend
• Failure modes addressed: whipsaws from fixed length MAs and outlier spikes that pull means
• Testable: Inputs expose all components and optional diagnostics show chosen length, directionality, and energy
• Portable yardstick: forecast cap uses mintick to stay symbol aware

Method overview in plain language
Base measures
• Range span of the tested window and a path energy defined as the sum of squared price increments, normalized by span
Components

Adaptive window chooser: scans L between Min and Max using an energy over trend score and picks the lowest score

Robust smoother: fits a quadratic to the last L bars, computes residuals, applies Huber weights and an exponential residual penalty scaled down when curvature is high

Forecast blend: projects one step ahead from the quadratic, caps displacement by a multiple of mintick, blends by user weight
Fusion rule
• Final line equals robust mean plus optional capped forecast blend
Signal rule
• Visual bias only: color turns lime when close is above the line, red otherwise

What you will see on the chart
• One colored line that tightens in trends and relaxes in chop
• Optional debug overlays for core value, chosen L, directionality, and energy
• Optional last bar label with L, directionality, and energy
• Reminder: drawings can move intrabar and settle on close


Inputs with guidance
Setup
• Source: price series to smooth
Logic
• Min window l_min. Typical 5 to 21. Higher increases stability, adds lag
• Max window l_max. Typical 40 to 128. Higher reduces noise, adds lag ceiling
• Length step grid_step. Typical 1 to 8. Smaller is finer and heavier
• Trend bias trend_bias. Typical 0.50 to 0.80. Higher favors trend persistence
• Residual penalty lambda_base. Typical 0.8 to 2.0. Higher downweights large residuals more
• Huber threshold huber_k. Typical 1.5 to 3.0. Higher admits more outliers
• Curvature guard curv_guard. Typical 0.3 to 1.0. Higher reduces influence when curve is tight
• Forecast blend lead_blend. 0 disables. Typical 0.10 to 0.40
• Forecast cap lead_limit. Typical 1 to 5 minticks
• Show chosen L and metrics show_debug. Diagnostics toggle


Optional: enable diagnostics to see length, direction, and energy


Realism and responsible publication
• No performance claims. Past results never guarantee future outcomes
• Shapes can move while bars are open and settle on close
• Use on standard candles for analysis and combine with your own risk process

Honest limitations and failure modes
• Very quiet regimes can reduce energy contrast, length selection may hover near the bounds
• Gap heavy symbols can disrupt quadratic fit on the window edges
• Excessive forecast blend may look anticipatory; use low values and the cap

Feragatname

Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.