OPEN-SOURCE SCRIPT

Trend Strength [OmegaTools]

479
Trend Strength is a quantitative regime oscillator designed to measure directional pressure and trend quality by blending price structure, return-dependence, realized intrabar expansion, and volume participation into a single normalized signal. The goal is not to predict, but to classify market state: when price action is in an expansionary/distributionary phase versus when it is in a contractionary/accumulation phase, so you can align execution and risk with the prevailing environment.

Core concept and methodology
The indicator aggregates four components computed on stable rolling windows and mapped into comparable ranges:

1. Price location / structural positioning (100-bar range)
A normalized price-location metric (position of close within the rolling high–low range) is transformed into a non-linear “strength” profile. This emphasizes meaningful departures from the middle of the range and penalizes indecision, producing a structure-aware contribution rather than a raw oscillator.

2. Return-dependence / directional persistence (100 bars)
A correlation term measures the relationship between the current return (close − close[1]) and the prior price level (close[1]). This helps detect environments where movement is more persistent or more mean-reverting, providing a statistical component that complements pure price-location signals.

3. Realized expansion / volatility proxy (50-bar accumulation, 300-bar normalization)
Intrabar expansion is approximated via the absolute candle body relative to the full range, aggregated over a short window to represent realized “effort” and then normalized over a longer window. This captures whether price is moving with meaningful body expansion versus compressing and stalling.

4. Volume participation (11-bar accumulation, 300-bar normalization)
A rolling volume sum is normalized over a longer window to quantify participation. This helps separate “thin” moves from moves supported by broader activity, without relying on exchange-specific volume assumptions.

The final oscillator is a weighted blend of these four normalized components, scaled for readability. The output is intentionally centered around two actionable regimes rather than a symmetric overbought/oversold framework.

How to read the oscillator
Trend Strength is designed around two main thresholds:

- Distribution / Expansion regime (oscillator above 0)
When the oscillator is above 0, the market is classified as being in a higher-pressure expansion regime. This often corresponds to directional continuation potential, stronger impulse behavior, and reduced suitability for tight mean-reversion tactics.

- Accumulation / Contraction regime (oscillator below −1.3)
When the oscillator is below −1.3, the market is classified as being in a contraction/accumulation regime. This frequently corresponds to compression, rotation, and lower directional efficiency, where breakouts may be more fragile and mean-reversion tactics may be more appropriate (depending on instrument and session conditions).

Values between 0 and −1.3 are treated as transitional/neutral, where the market is not clearly committing to either regime.

Continuous Mode vs Standard Mode
Trend Strength includes an optional Continuous Mode to improve interpretability during regime transitions:

- Standard Mode colors only when the oscillator is firmly in one of the two regimes (above 0 or below −1.3). Neutral zones remain uncolored, keeping the display conservative.

- Continuous Mode adds persistence logic: once a regime is confirmed, intermediate values are rendered with a lighter shade of the last confirmed regime until the opposite regime is confirmed. This reduces visual noise, helps maintain a consistent directional bias framework, and is particularly useful for intraday execution and session trend management.

Visual design and bar coloring
The oscillator line is color-coded:

- Purple: distribution / expansion regime
- Orange: accumulation / contraction regime
Neutral/transitional values are displayed in grey (or lightly shaded in Continuous Mode based on last confirmed regime).
Optionally, the indicator can color price bars using the same regime logic, allowing rapid at-a-glance regime recognition directly on the chart.

Practical use cases

- Regime filter for strategies: enable trend-following logic only in expansion regimes; enable mean-reversion or range logic in contraction regimes.
- Risk adjustment: increase/decrease position sizing or tighten/widen stops based on regime classification.
- Confirmation layer: combine with structure tools (market structure, VWAP, key levels) to validate whether conditions support continuation or imply compression.
- Session management: identify when a session is behaving as a trend day versus a rotational day, improving trade selection and reducing overtrading.

Notes
Trend Strength is a regime classifier and contextual tool. It does not guarantee future direction and should be integrated into a complete decision process (risk management, market structure, session context, and instrument-specific behavior).

© OmegaTools

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.