OPEN-SOURCE SCRIPT
Dynamic Sigmoid ATR-Normalized EMA Distance Oscillator

Dynamic Sigmoid ATR-Normalized EMA Distance Oscillator
Overview
This indicator is built to evaluate trend strength and trend sustainability, not to prioritize mean-reversion calls.
It measures directional pressure relative to a long-term EMA, scales that pressure by current volatility, and maps the result into a stable 0-100 oscillator using a sigmoid transform.
The key advantage is dynamic adaptation: center and regime bands are not static references only, they adjust to evolving oscillator behavior.
This helps separate healthy trend continuation from weak, noisy movement.
Mathematical Construction (No Code Description)
1) Trend baseline:
A long-horizon exponential moving average defines structural direction.
2) Signed distance:
Distance = Price - EMA
Positive values imply price is structurally above baseline; negative values imply below-baseline pressure.
3) Volatility normalization:
Normalized Distance = Distance / ATR
This makes the signal scale-aware across different volatility environments.
4) Nonlinear compression:
Sigmoid(x) = 1 / (1 + e^(-k*x))
The multiplier k controls response sharpness.
The output is then scaled to 0-100.
5) Dynamic center:
Center = EMA of oscillator values (adaptive midpoint).
Optional fixed midpoint mode is available for a classic 50-line reference.
6) Dynamic regime bands:
Upper Band = Center + (StdDev of oscillator * multiplier)
Lower Band = Center - (StdDev of oscillator * multiplier)
These bands expand/contract with oscillator volatility, making the framework regime-aware.
How to Read It (Trend-Focused)
- Oscillator above dynamic center: bullish pressure dominates current regime.
- Oscillator below dynamic center: bearish pressure dominates current regime.
- Persistent distance from center: trend continuation probability is generally stronger.
- Oscillator flattening back toward center: trend sustainability may be weakening.
Long and Short Signal Framework
Long setup concept:
1) Oscillator crosses above dynamic center.
2) Oscillator remains above center for multiple bars (persistence confirmation).
3) Pullbacks that hold above center and re-expand upward can be treated as continuation entries.
Short setup concept:
1) Oscillator crosses below dynamic center.
2) Oscillator remains below center for multiple bars.
3) Bounces that fail near center and rotate down can be treated as continuation entries.
Strength confirmation:
- Rising histogram above zero supports long continuation quality.
- Falling histogram below zero supports short continuation quality.
Example Use Cases (Educational)
Example A - Long trend continuation:
- Market transitions from neutral to bullish as oscillator crosses and holds above center.
- Dynamic upper band begins rising, indicating expanding bullish regime capacity.
- Dips in oscillator that stay above center suggest trend remains structurally intact.
Example B - Short trend continuation:
- Oscillator breaks below center and stays suppressed under it.
- Lower band trends down while histogram remains negative.
- Failed recoveries toward center often mark lower-risk continuation timing.
Example C - Potential trend fatigue:
- Price makes a new directional push, but oscillator fails to sustain distance from center.
- Histogram contracts progressively.
- This can indicate weakening impulse and the need for tighter risk control.
Why Dynamic Components Matter
- A fixed 50-level alone can be too rigid when regime characteristics shift.
- Dynamic center adapts to the oscillator's local equilibrium.
- Dynamic bands adapt to oscillator variance, helping contextualize what is truly "extended" in current conditions.
Inputs (Configurable Parameters)
- EMA Length: structural trend anchor sensitivity.
- ATR Length: volatility normalization depth.
- Sigmoid Multiplier: nonlinear response intensity.
- Use Dynamic Center: adaptive center or fixed 50 reference.
- Center Length: smoothness of adaptive center behavior.
- Band Length: lookback horizon for oscillator variance.
- Band Stdev Multiplier: adaptive band width.
- Visual toggles: gradient and table display options.
Risk and Implementation Notes
- This is an analytical framework, not a guaranteed signal engine.
- Choppy markets can still produce false transitions.
- Parameter calibration should be done per symbol and timeframe with independent testing.
- Position sizing, stop logic, and risk limits remain essential.
Publishing and Compliance Notes
- Educational and analytical content only; not financial advice.
- No guaranteed returns, no performance promises, no misleading language.
- Real-world outcomes vary by market conditions, execution, and risk management.
Overview
This indicator is built to evaluate trend strength and trend sustainability, not to prioritize mean-reversion calls.
It measures directional pressure relative to a long-term EMA, scales that pressure by current volatility, and maps the result into a stable 0-100 oscillator using a sigmoid transform.
The key advantage is dynamic adaptation: center and regime bands are not static references only, they adjust to evolving oscillator behavior.
This helps separate healthy trend continuation from weak, noisy movement.
Mathematical Construction (No Code Description)
1) Trend baseline:
A long-horizon exponential moving average defines structural direction.
2) Signed distance:
Distance = Price - EMA
Positive values imply price is structurally above baseline; negative values imply below-baseline pressure.
3) Volatility normalization:
Normalized Distance = Distance / ATR
This makes the signal scale-aware across different volatility environments.
4) Nonlinear compression:
Sigmoid(x) = 1 / (1 + e^(-k*x))
The multiplier k controls response sharpness.
The output is then scaled to 0-100.
5) Dynamic center:
Center = EMA of oscillator values (adaptive midpoint).
Optional fixed midpoint mode is available for a classic 50-line reference.
6) Dynamic regime bands:
Upper Band = Center + (StdDev of oscillator * multiplier)
Lower Band = Center - (StdDev of oscillator * multiplier)
These bands expand/contract with oscillator volatility, making the framework regime-aware.
How to Read It (Trend-Focused)
- Oscillator above dynamic center: bullish pressure dominates current regime.
- Oscillator below dynamic center: bearish pressure dominates current regime.
- Persistent distance from center: trend continuation probability is generally stronger.
- Oscillator flattening back toward center: trend sustainability may be weakening.
Long and Short Signal Framework
Long setup concept:
1) Oscillator crosses above dynamic center.
2) Oscillator remains above center for multiple bars (persistence confirmation).
3) Pullbacks that hold above center and re-expand upward can be treated as continuation entries.
Short setup concept:
1) Oscillator crosses below dynamic center.
2) Oscillator remains below center for multiple bars.
3) Bounces that fail near center and rotate down can be treated as continuation entries.
Strength confirmation:
- Rising histogram above zero supports long continuation quality.
- Falling histogram below zero supports short continuation quality.
Example Use Cases (Educational)
Example A - Long trend continuation:
- Market transitions from neutral to bullish as oscillator crosses and holds above center.
- Dynamic upper band begins rising, indicating expanding bullish regime capacity.
- Dips in oscillator that stay above center suggest trend remains structurally intact.
Example B - Short trend continuation:
- Oscillator breaks below center and stays suppressed under it.
- Lower band trends down while histogram remains negative.
- Failed recoveries toward center often mark lower-risk continuation timing.
Example C - Potential trend fatigue:
- Price makes a new directional push, but oscillator fails to sustain distance from center.
- Histogram contracts progressively.
- This can indicate weakening impulse and the need for tighter risk control.
Why Dynamic Components Matter
- A fixed 50-level alone can be too rigid when regime characteristics shift.
- Dynamic center adapts to the oscillator's local equilibrium.
- Dynamic bands adapt to oscillator variance, helping contextualize what is truly "extended" in current conditions.
Inputs (Configurable Parameters)
- EMA Length: structural trend anchor sensitivity.
- ATR Length: volatility normalization depth.
- Sigmoid Multiplier: nonlinear response intensity.
- Use Dynamic Center: adaptive center or fixed 50 reference.
- Center Length: smoothness of adaptive center behavior.
- Band Length: lookback horizon for oscillator variance.
- Band Stdev Multiplier: adaptive band width.
- Visual toggles: gradient and table display options.
Risk and Implementation Notes
- This is an analytical framework, not a guaranteed signal engine.
- Choppy markets can still produce false transitions.
- Parameter calibration should be done per symbol and timeframe with independent testing.
- Position sizing, stop logic, and risk limits remain essential.
Publishing and Compliance Notes
- Educational and analytical content only; not financial advice.
- No guaranteed returns, no performance promises, no misleading language.
- Real-world outcomes vary by market conditions, execution, and risk management.
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
For help and support, feel free to contact:
wa.me/905469061306
wa.me/905469061306
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
For help and support, feel free to contact:
wa.me/905469061306
wa.me/905469061306
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。