OPEN-SOURCE SCRIPT

Impulse Memory Engine [JOAT]

744
Impulse Memory Engine is an open-source Pine Script v6 overlay that measures fresh displacement, stores directional memory with exponential decay, and displays adaptive retest rails after significant impulse bars. It is built to answer a simple question: is the most recent meaningful impulse still fresh enough to matter?

The script blends MAD-style distance, ATR, trend basis, and decay memory. This creates a visual layer that distinguishes fresh impulse, fading impulse, and reset conditions while keeping the chart clean.

снимок

Core Concepts

1. MAD and ATR Normalized Displacement

The script estimates a robust distance unit using median absolute deviation and ATR. The impulse score is the one-bar displacement divided by this unit.

Pine Script®


2. Trend Basis and Fast Track

A slower EMA defines the trend basis while a faster EMA tracks near-term movement. The distance between them contributes to the heat score.

3. Freshness Decay

When a bullish or bearish impulse appears, the script measures bars since that impulse and applies exponential decay. Fresh impulses have more weight; older impulses fade naturally.

Pine Script®


4. Adaptive Bands

The trend band widens when memory strength increases. This helps separate quiet reset states from active impulse regimes.

5. Retest Rails

After a fresh impulse, the script stores a rail near the impulse bar. A confirmed retest occurs when price revisits the rail while memory remains directionally active.

Features

  • Impulse score: Measures displacement relative to MAD and ATR distance
  • Memory decay model: Tracks whether the last strong impulse is fresh or fading
  • Adaptive trend cloud: EMA basis and fast track are filled by memory state
  • Dynamic bands: Band width expands with volatility and impulse memory
  • Retest rails: Bull and bear rails remain visible for a configurable window
  • Rail labels: Active bull and bear rails are labeled at the right edge with spacing protection when both rails are close
  • Confirmed buy/sell labels: Compact BUY and SELL labels mark fresh impulse continuation or rail retest continuation on confirmed bars
  • Heat candles: Optional candle coloring by impulse and memory strength
  • Dashboard: Top-right panel shows impulse, memory, state, and rail status
  • Alerts: Fresh impulse, rail retest, confirmed buy, and confirmed sell conditions


Input Parameters

  • Source: Price source used for calculations
  • Trend Length: Slow EMA basis length
  • Fast Track Length: Faster EMA used inside the cloud
  • MAD Length: Median distance length
  • ATR Length: ATR distance length
  • Band Multiplier: Scales adaptive bands
  • Impulse Threshold: Minimum normalized displacement for a fresh impulse
  • Memory Half Window: Controls decay speed
  • Rail Visibility: Bars a rail remains eligible for retests
  • Heat Candles: Enables candle coloring
  • Dashboard: Shows or hides the top-right dashboard
  • Rail Labels: Shows active bull and bear rail labels
  • Buy/Sell Signals: Shows confirmed continuation signal labels
  • Palette: Selects the local JOAT color preset
  • Dashboard: Shows the panel
  • Palette: Selects color pair


How to Use This Indicator

Step 1: Read the Memory State
The dashboard state shows whether the script is tracking bull memory, bear memory, or resetting.

Step 2: Watch Fresh Impulse Events
Fresh impulse alerts show that displacement exceeded the configured threshold in the direction of the trend basis.

Step 3: Use Retest Rails
Rails act as reference levels after impulse. A retest is most meaningful when the dashboard memory state still agrees with the rail direction.

Indicator Limitations

  • Impulse detection is sensitive to the selected source and threshold
  • Very low volatility can make normalized movement appear larger
  • A rail retest is contextual and does not define risk by itself
  • The memory model fades old impulses; it does not predict the next impulse


Originality Statement

Impulse Memory Engine is original in its use of robust distance normalization, exponential impulse decay, adaptive bands, and retest rails in one compact overlay. It is built with original Pine v6 logic and public mathematical functions.

Disclaimer

This script is provided for educational and informational use only. It is not financial advice or a recommendation to buy or sell any financial instrument. Trading involves substantial risk of loss. Impulse readings can fail during choppy markets or sudden volatility shifts. Always use independent analysis and proper risk management.

-Made with passion by jackofalltrades

Отказ от ответственности

Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.