OPEN-SOURCE SCRIPT

Dynamic Slope-Compressed TMA

240
This indicator is a modified Triangular Moving Average-style band system designed to adapt its upper and lower bands based on directional moving-average slope.

The midline is built from a TMA-style smoothing structure using selectable WMA, DWMA, or TWMA logic, with ATR-based upper and lower bands around the midline. The key feature is dynamic band compression: when the selected slope MA is strongly rising, the upper band remains fully expanded while the lower band gradually compresses toward the midline. When the selected slope MA is strongly falling, the lower band remains fully expanded while the upper band gradually compresses toward the midline.

This creates an adaptive channel that reflects directional pressure. In strong uptrends, downside band space contracts toward the midline. In strong downtrends, upside band space contracts toward the midline. At maximum slope strength, the compressed side can reach the midline, depending on the user’s settings.

Main features:

TMA-style midline using selectable WMA, DWMA, or TWMA smoothing
ATR-based upper and lower bands
Dynamic slope-based compression of the opposite-side band
User-selectable slope MA type, length, lookback, and source
Adjustable slope sensitivity using ATR-normalized slope strength
Optional minimum compressed band width
Optional original uncompressed bands for comparison
Optional debug values for compression and slope behavior

How it works:

The indicator calculates a TMA-style midline and standard ATR bands. It then measures the slope of a user-selected moving average. When slope strength increases upward, the lower band moves closer to the midline while the upper band stays at the normal ATR distance. When slope strength increases downward, the upper band moves closer to the midline while the lower band stays at the normal ATR distance.

This can help visualize when price is trending strongly enough that one side of the channel should tighten rather than remain symmetrical.

Suggested use:

This indicator can be used as a trend-aware volatility channel, a directional mean-reversion reference, or a visual filter for overextended price action. It is not intended to be used as a standalone buy/sell signal. Traders should combine it with their own confirmation tools, market structure, volume/VWAP, or higher-timeframe analysis.

Important note:

This indicator does not guarantee future price movement. It is a visual and analytical tool only. Use proper risk management and test all settings before using it in live trading.

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.