OPEN-SOURCE SCRIPT

Prism Moving Average Trend

1 854
Prism Moving Average Trend | MisinkoMaster

The Prism Moving Average Trend (PriMAT) is an advanced trend-following overlay engineered to capture market regimes with high precision and low latency. By blending sinusoidal weighting mechanics with exponential smoothing, PriMAT creates a fluid, wave-like moving average baseline that dynamically adapts to structural price shifts while filtering out market noise.

Rather than relying solely on price crossovers or raw slope direction, PriMAT incorporates volatility-adjusted bands alongside Rate of Change (ROC) slope confirmation to validate trend transitions, preventing whipsaws during low-volatility consolidation.

How does it work?

Dual-Stage Prism Smoothing Engine:

Sinusoidal Weighting: The inner PRISM algorithm calculates a custom weighted moving average using a trigonometric weighting function ((sin(angle) + cos(angle) + 1) / 2) applied across the lookback window. This distributes weights in a smooth, wave-like curve across historical bars.

Exponential Blending: The weighted base calculation is blended with immediate price action using an exponential factor (alpha = 2 / (1 + len)).

Cascade Smoothing: The script calculates a primary PRISM baseline over the main lookback period (len), followed by a secondary PRISM pass over the square root of the lookback period (sqrtlen) for ultra-smooth tracking without phase lag.

ATR Volatility Bands:

Upper and lower bands are expanded around the double-smoothed Prism line using average true range scaled by a customizable multiplier (vol = ta.atr(len) * mul).

Dual-Condition Regime Logic:

Bullish Shift (1): Triggered when price closes above the upper volatility band (src > upper) AND the Prism line slope is positive (change > 0).

Bearish Shift (-1): Triggered when price closes below the lower volatility band (src < lower) AND the Prism line slope is negative (change < 0).

Integrated Reversal Warning System (Danger Alert):

The indicator measures distance between price and the Prism baseline relative to active trend direction ((src - prism) * trend).

When this metric reaches its lowest point over the lookback window, it highlights the chart background with a bright yellow warning. This alerts you to extreme momentum deceleration or structural exhaustion where price may reverse before the main indicator trend state flips.

Key Features

Hybrid Wave Smoothing: Combines sinusoidal weighting with exponential blending for smooth curve tracking and minimal lag.

Volatility Band Filtering: Requires price to break beyond ATR volatility channels before confirming regime changes, eliminating false signals in tight ranges.

Dynamic Reversal Warnings: Built-in background highlights warn of potential trend exhaustion prior to trend flips.

On-Chart Candle Morphing: Recolors main price candles (vibrant neon teal for bullish regimes, vivid magenta for bearish regimes) to maintain clean visual alignment.

Input Parameters & Optimization Guide

Source: Sets the input price series used for calculations.

Lookback: Sets the evaluation window for the primary Prism calculation and ATR channels. A default of 31 provides strong macro trend stability.

Multiplier: Controls the width of the ATR volatility bands around the Prism line.

Trading Strategies & Execution

Volatility Band Trend Entries

Bullish Alignment: Confirmed when price breaks above the upper Prism band while the Prism slope is positive, flipping price chart candles neon teal.

Bearish Alignment: Confirmed when price breaks below the lower Prism band while the Prism slope is negative, flipping price chart candles vivid magenta.

Divergence & Reversal Alerts (Danger Warnings)

When a yellow background highlight appears during an active trend, it indicates price has moved excessively close to or against the Prism line relative to the lookback period.

Disclaimer: Trading financial markets involves high risk. This technical script is designed as an informational analytical tool to support your rule-based mechanical execution system and does not constitute financial advice.

Haftungsausschluss

Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.