OPEN-SOURCE SCRIPT
Liquidity Shock Recovery Lens [Pineify]

Overview
The pane follows a confirmed high-volume, wide-range bar. Energy and return columns separate fading activity from origin return. Liquidity shock is an OHLCV proxy, not measured order-book depth.
Problem Definition
A volume spike cannot distinguish persistent displacement from a brief disturbance. A smaller next bar is insufficient: activity may fade while price stays far from its starting point. The question is whether displacement persists, trading contracts inside the shock interval, or price returns efficiently toward the origin. Recovery requires location and participation evidence together.
Design Rationale
Volume uses a prior-window median and true range uses prior ATR, excluding the candidate. Both triggers must pass. Baselines, the pre-shock close and interval then freeze so an event cannot redefine normality. Restarting on every spike was rejected because it erases an unresolved path. A finite age prevents indefinite retention. Hysteresis reduces threshold flicker but delays transitions; a consecutive-bar origin hold makes completion stricter than activity decay alone.
Key Features
How It Works
After full prior coverage, default triggers require volume twice its 50-bar median and true range 1.8 times prior ATR. Seed energy is 100 times x/(1+x), where x is the geometric mean of trigger-relative ratios. Follow-up range and volume blend equally with their previous event values. Residual energy multiplies the seed by their geometric ratio to shock activity, capped at the seed.
Retention is signed origin distance divided by the larger of initial close displacement and a quarter of shock range. Continuation also requires net movement from the shock close divided by accumulated close travel and sustained volume. Absorption uses the share of follow-up closes inside the frozen high-low interval and contracting range. Return progress is retracement from the farthest origin distance divided by that distance; return efficiency divides retracement by close travel since that extreme. A new or equal extreme resets the return path. Both are bounded at 0-1.
After minimum age, priority is continuation, returning, absorption, then shock. Recovery requires consecutive closes near the origin while smoothed range and volume meet frozen-baseline quiet limits. Completion beats timeout only when the full hold is met. Missing price or positive volume ends the event without recovery.
How Multiple Indicators Work Together
The trigger establishes an event; frozen references keep its aftermath comparable. Retention and net/travel efficiency distinguish persistence from wandering. Residence identifies interval contraction. Return efficiency discounts noisy retracement. Quiet activity cannot finish recovery without origin proximity, and proximity cannot finish it while activity remains elevated.
Trading Ideas and Insights
Continuation describes observed persistence; absorption means interval residence and range contraction, not proof of hidden orders. Returning may fail before recovery. Timeout means unresolved observation. Compare these states with price structure and execution constraints before using a liquidity shock indicator as trade context.
Unique Aspects
A spike marker or rolling volatility oscillator loses event context. This lens preserves the original ruler, distinguishes dissipation from efficient origin return, and requires a quiet origin hold. Different entry and exit thresholds stabilize path states; later shocks cannot erase an active path. The contribution lies in frozen references and completion logic.
How to Use
Use standard candles on liquid stocks, ETFs, futures or crypto with usable volume, initially on 5-minute to daily charts. Wait for maturity and a diamond. Read the field with negative return columns and state text. Squares mark absorption, circles recovery and crosses unresolved endings. Set alerts once per bar close.
Customization
Baseline length and surprise thresholds select events. Minimum age, age limit, origin tolerance, quiet range/volume limits and hold length govern completion; the continuation threshold governs persistence. The limit must permit minimum age plus the hold. Defaults are starting points. Component curves explain pressure; secondary layers can be hidden.
Assumptions and Limitations
OHLCV cannot establish depth or aggressive trade direction. Gaps enter true range, feed volume may be incomparable, and synthetic candles alter inputs. Full prior coverage is required; missing or zero event volume invalidates it. States, curves and alerts update at confirmed closes; live candidate ratios can change intrabar. Smoothing and holds add lag. Thresholds affect event selection, and a trend may never revisit the origin. Repeated shocks are ignored while active. Outcomes last one bar before monitoring resumes. Loaded history affects initialization. No profitability or prediction claim is made.
Conclusion
Use the lens to distinguish fading activity from a quiet return near a frozen origin. Confirmed recovery is an observed event outcome, not evidence that the market is safe or that its next move is known.
The pane follows a confirmed high-volume, wide-range bar. Energy and return columns separate fading activity from origin return. Liquidity shock is an OHLCV proxy, not measured order-book depth.
Problem Definition
A volume spike cannot distinguish persistent displacement from a brief disturbance. A smaller next bar is insufficient: activity may fade while price stays far from its starting point. The question is whether displacement persists, trading contracts inside the shock interval, or price returns efficiently toward the origin. Recovery requires location and participation evidence together.
Design Rationale
Volume uses a prior-window median and true range uses prior ATR, excluding the candidate. Both triggers must pass. Baselines, the pre-shock close and interval then freeze so an event cannot redefine normality. Restarting on every spike was rejected because it erases an unresolved path. A finite age prevents indefinite retention. Hysteresis reduces threshold flicker but delays transitions; a consecutive-bar origin hold makes completion stricter than activity decay alone.
Key Features
- Frozen event references and a bounded observation age.
- Shock, continuation, absorption and returning states; separate recovery, timeout and data-gap outcomes.
- Energy above zero and return quality below zero.
- Optional component curves, wash, symbols and dashboard.
How It Works
After full prior coverage, default triggers require volume twice its 50-bar median and true range 1.8 times prior ATR. Seed energy is 100 times x/(1+x), where x is the geometric mean of trigger-relative ratios. Follow-up range and volume blend equally with their previous event values. Residual energy multiplies the seed by their geometric ratio to shock activity, capped at the seed.
Retention is signed origin distance divided by the larger of initial close displacement and a quarter of shock range. Continuation also requires net movement from the shock close divided by accumulated close travel and sustained volume. Absorption uses the share of follow-up closes inside the frozen high-low interval and contracting range. Return progress is retracement from the farthest origin distance divided by that distance; return efficiency divides retracement by close travel since that extreme. A new or equal extreme resets the return path. Both are bounded at 0-1.
After minimum age, priority is continuation, returning, absorption, then shock. Recovery requires consecutive closes near the origin while smoothed range and volume meet frozen-baseline quiet limits. Completion beats timeout only when the full hold is met. Missing price or positive volume ends the event without recovery.
How Multiple Indicators Work Together
The trigger establishes an event; frozen references keep its aftermath comparable. Retention and net/travel efficiency distinguish persistence from wandering. Residence identifies interval contraction. Return efficiency discounts noisy retracement. Quiet activity cannot finish recovery without origin proximity, and proximity cannot finish it while activity remains elevated.
Trading Ideas and Insights
Continuation describes observed persistence; absorption means interval residence and range contraction, not proof of hidden orders. Returning may fail before recovery. Timeout means unresolved observation. Compare these states with price structure and execution constraints before using a liquidity shock indicator as trade context.
Unique Aspects
A spike marker or rolling volatility oscillator loses event context. This lens preserves the original ruler, distinguishes dissipation from efficient origin return, and requires a quiet origin hold. Different entry and exit thresholds stabilize path states; later shocks cannot erase an active path. The contribution lies in frozen references and completion logic.
How to Use
Use standard candles on liquid stocks, ETFs, futures or crypto with usable volume, initially on 5-minute to daily charts. Wait for maturity and a diamond. Read the field with negative return columns and state text. Squares mark absorption, circles recovery and crosses unresolved endings. Set alerts once per bar close.
Customization
Baseline length and surprise thresholds select events. Minimum age, age limit, origin tolerance, quiet range/volume limits and hold length govern completion; the continuation threshold governs persistence. The limit must permit minimum age plus the hold. Defaults are starting points. Component curves explain pressure; secondary layers can be hidden.
Assumptions and Limitations
OHLCV cannot establish depth or aggressive trade direction. Gaps enter true range, feed volume may be incomparable, and synthetic candles alter inputs. Full prior coverage is required; missing or zero event volume invalidates it. States, curves and alerts update at confirmed closes; live candidate ratios can change intrabar. Smoothing and holds add lag. Thresholds affect event selection, and a trend may never revisit the origin. Repeated shocks are ignored while active. Outcomes last one bar before monitoring resumes. Loaded history affects initialization. No profitability or prediction claim is made.
Conclusion
Use the lens to distinguish fading activity from a quiet return near a frozen origin. Confirmed recovery is an observed event outcome, not evidence that the market is safe or that its next move is known.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
🚀🚀🚀 Pineify - pineify.app
Essential Toolkit for Every Trader
- AI Pine Script Generator
- Finance AI Agent
- AI Stock Picker
- Pine Script Visual Editor
- Invited indicators
- Strategy Optimizer
- Trading Journal
- Backtest Report
Essential Toolkit for Every Trader
- AI Pine Script Generator
- Finance AI Agent
- AI Stock Picker
- Pine Script Visual Editor
- Invited indicators
- Strategy Optimizer
- Trading Journal
- Backtest Report
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
🚀🚀🚀 Pineify - pineify.app
Essential Toolkit for Every Trader
- AI Pine Script Generator
- Finance AI Agent
- AI Stock Picker
- Pine Script Visual Editor
- Invited indicators
- Strategy Optimizer
- Trading Journal
- Backtest Report
Essential Toolkit for Every Trader
- AI Pine Script Generator
- Finance AI Agent
- AI Stock Picker
- Pine Script Visual Editor
- Invited indicators
- Strategy Optimizer
- Trading Journal
- Backtest Report
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.