OPEN-SOURCE SCRIPT
Dual Shock SPMA | NAL

1. Overview
Dual Shock SPMA | NAL is a dual-memory trend indicator designed to separately track how significant bullish and bearish price shocks are developing through time.
Unlike the standard Shock Percentile Moving Average, the Dual Shock SPMA maintains two independent adaptive baselines. Positive shocks update the Bull Shock SPMA, while negative shocks update the Bear Shock SPMA.
This creates two separate memories of where statistically stronger directional moves have occurred, allowing the indicator to evaluate the relationship between bullish and bearish shock structure rather than treating all large movements as one stream.
2. Calculation
The indicator begins by calculating the percentage return of the selected source and ranking the absolute magnitude of that return against recent history.
Pine Script®
Because the percentile calculation uses the absolute return, bullish and bearish shocks are ranked against the same magnitude distribution.
The direction of the return then determines which baseline is allowed to update.
Pine Script®
A qualifying positive shock updates only the Bull Shock SPMA. A qualifying negative shock updates only the Bear Shock SPMA. Otherwise, each baseline retains its previous value.
Pine Script®
Each shock stream then maintains its own directional memory.
A rising Bull SPMA means significant positive shocks are occurring at progressively higher price levels. A rising Bear SPMA means significant negative shocks are also occurring at progressively higher levels. The inverse applies when either baseline is declining.
Pine Script®
The final state requires agreement between both shock memories.
For a bullish regime, both baselines must be trending upward and the Bull SPMA must remain above the Bear SPMA. For a bearish regime, both must be trending downward and their ordering must reverse.
An optional midpoint gate can additionally require price to remain aligned with the center of the dual-shock structure.
Pine Script®
3. Key Features
4. Use
Dual Shock SPMA is designed to analyze how significant positive and negative price events are evolving relative to one another.
Rather than treating volatility as a single undifferentiated stream, the indicator preserves separate memories for each side of the market. This makes the relationship between bullish and bearish shock structure itself part of the signal.
The spread between the two baselines visually represents this evolving relationship, while the midpoint provides a central reference for the combined shock structure.
Dual Shock SPMA is designed as a specialized structural component within a complete strategy framework. Its role is to identify when independently maintained bullish and bearish shock memories begin establishing directional agreement, providing a distinct layer of information about the underlying development of larger price movements.
Dual Shock SPMA | NAL is a dual-memory trend indicator designed to separately track how significant bullish and bearish price shocks are developing through time.
Unlike the standard Shock Percentile Moving Average, the Dual Shock SPMA maintains two independent adaptive baselines. Positive shocks update the Bull Shock SPMA, while negative shocks update the Bear Shock SPMA.
This creates two separate memories of where statistically stronger directional moves have occurred, allowing the indicator to evaluate the relationship between bullish and bearish shock structure rather than treating all large movements as one stream.
2. Calculation
The indicator begins by calculating the percentage return of the selected source and ranking the absolute magnitude of that return against recent history.
Because the percentile calculation uses the absolute return, bullish and bearish shocks are ranked against the same magnitude distribution.
The direction of the return then determines which baseline is allowed to update.
A qualifying positive shock updates only the Bull Shock SPMA. A qualifying negative shock updates only the Bear Shock SPMA. Otherwise, each baseline retains its previous value.
Each shock stream then maintains its own directional memory.
A rising Bull SPMA means significant positive shocks are occurring at progressively higher price levels. A rising Bear SPMA means significant negative shocks are also occurring at progressively higher levels. The inverse applies when either baseline is declining.
The final state requires agreement between both shock memories.
For a bullish regime, both baselines must be trending upward and the Bull SPMA must remain above the Bear SPMA. For a bearish regime, both must be trending downward and their ordering must reverse.
An optional midpoint gate can additionally require price to remain aligned with the center of the dual-shock structure.
3. Key Features
- Separate bullish and bearish shock-memory baselines.
- Absolute-return percentile ranking for directly comparable shock magnitude.
- Event-driven updates restricted to statistically stronger price movements.
- Independent directional memory for positive and negative shocks.
- Dual-baseline agreement and relative-position logic.
- Optional price midpoint confirmation.
- Optional neutral state during unresolved shock structure.
- Shock-memory spread visualization and state-based candle coloring.
4. Use
Dual Shock SPMA is designed to analyze how significant positive and negative price events are evolving relative to one another.
Rather than treating volatility as a single undifferentiated stream, the indicator preserves separate memories for each side of the market. This makes the relationship between bullish and bearish shock structure itself part of the signal.
The spread between the two baselines visually represents this evolving relationship, while the midpoint provides a central reference for the combined shock structure.
Dual Shock SPMA is designed as a specialized structural component within a complete strategy framework. Its role is to identify when independently maintained bullish and bearish shock memories begin establishing directional agreement, providing a distinct layer of information about the underlying development of larger price movements.
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
🔵 Access our best trading & investing tools, get a 30-day free trial today: whop.com/nordic-alpha-lab/
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
🔵 Access our best trading & investing tools, get a 30-day free trial today: whop.com/nordic-alpha-lab/
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。