OPEN-SOURCE SCRIPT

Obsidian Flux Matrix

108
# Obsidian Flux Matrix | JackOfAllTrades
Made with my Senior Level AI Pine Script v6 coding bot for the community!

Narrative Overview
Obsidian Flux Matrix (OFM) is an open-source Pine Script v6 study that fuses social sentiment, higher timeframe trend bias, fair-value-gap detection, liquidity raids, VWAP gravitation, session profiling, and a diagnostic HUD. The layout keeps the obsidian palette so critical overlays stay readable without overwhelming a price chart.

Purpose & Scope
OFM focuses on actionable structure rather than marketing claims. It documents every driver that powers its confluence engine so reviewers understand what triggers each visual.


Core Analytical Pillars

1. Social Pulse Engine
  • Sentiment Webhook Feed: Accepts normalized scores (-1 to +1). Signals only arm when the EMA-smoothed value exceeds the `sentimentMin` input (0.35 by default).
  • Volume Confirmation: Requires local volume > 30-bar average × `volSpikeMult` (default 2.0) before sentiment flags.
  • EMA Cross Validation: Fast EMA 8 crossing above/below slow EMA 21 keeps momentum aligned with flow.
  • Momentum Alignment: Multi-timeframe momentum composite must agree (positive for longs, negative for shorts).


2. Peer Momentum Heatmap
  • Multi-Timeframe Blend: RSI + Stoch RSI fetched via
    Pine Script®
    request.security()
    on 1H/4H/1D by default.
  • Composite Scoring: Each timeframe votes +1/-1/0; totals are clamped between -3 and +3.
  • Intraday Readability: Configurable band thickness (1-5) so scalpers see context without losing space.
  • Dynamic Opacity: Stronger agreement boosts column opacity for quick bias checks.



3. Trend & Displacement Framework
  • Dual EMA Ribbon: Cyan/magenta ribbon highlights immediate posture.
  • HTF Bias: A higher-timeframe EMA (default 55 on 4H) sets macro direction.
  • Displacement Score: Body-to-ATR ratio (>1.4 default) detects impulses that seed FVGs or VWAP raids.
  • ATR Normalization: All thresholds float with volatility so the study adapts to assets and regimes.


snapshot

4. Intelligent Fair Value Gap (FVG) System
  • Gap Detection: Three-candle logic (bullish: low > high[2]; bearish: high < low[2]) with ATR-sized minimums (0.15 × ATR default).
  • Overlap Prevention: Price-range checks stop redundant boxes.
  • Spacing Control: `fvgMinSpacing` (default 5) avoids stacking from the same impulse.
  • Storage Caps: Max three FVGs per side unless the user widens the limit.
  • Session Awareness: Kill zone filters keep taps focused on London/NY if desired.
  • Auto Cleanup: Boxes delete when price closes beyond their invalidation level.


5. VWAP Magnet + Liquidity Raid Engine
  • Session or Rolling VWAP: Toggle resets to match intraday or rolling preferences.
  • Equal High/Low Scanner: Looks back 20 bars by default for liquidity pools.
  • Displacement Filter: ATR multiplier ensures raids represent genuine liquidity sweeps.
  • Mean Reversion Focus: Signals fire when price displaces back toward VWAP following a raid.


6. Session Range Breakout System
  • Initial Balance Tracking: First N bars (15 default) define the session box.
  • Breakout Logic: Requires simultaneous liquidity spikes, nearby FVG activity, and supportive momentum.
  • Z-Score Volume Filter: >1.5σ by default to filter noisy moves.


7. Lifestyle Liquidity Scanner
  • Volume Z-Scores: 50-bar baseline highlights statistically significant spikes.
  • Smart Money Footprints: Bottom-of-chart squares color-code buy vs sell participation.
  • Panel Memory: HUD logs the last five raid timestamps, direction, and normalized size.


8. Risk Matrix & Diagnostic HUD
  • HUD Structure: Table in the top-right summarizes HTF bias, sentiment, momentum, range state, liquidity memory, and current risk references.
  • Signal Tags: Aggregates SPS, FVG, VWAP, Range, and Liquidity states into a compact string.
  • Risk Metrics: Swing-based stops (5-bar lookback) + ATR targets (1.5× default) keep risk transparent.


Signal Families & Alerts
  • Social Pulse (SPS): Volume-confirmed sentiment alignment; triangle markers with “SPS”.
  • Kill-Zone FVG: Session + HTF alignment + FVG tap; arrow markers plus SL/TP labels.
  • Local FVG: Captures local reversals when HTF bias has not flipped yet.
  • VWAP Raid: Equal-high/low raids that snap toward VWAP; “VWAP” label markers.
  • Range Breakout: Initial balance violations with liquidity and imbalance confirmation; circle markers.
  • Liquidity Spike: Z-score spikes ≥ threshold; square markers along the baseline.


snapshot

Visual Design & Customization
  • Theme Palette: Primary background RGB (12,6,24). Accent shading RGB (26,10,48). Long accents RGB (88,174,255). Short accents RGB (219,109,255).
  • Stylized Candles: Optional overlay using theme colors.
  • Signal Toggles: Independently enable markers, heatmap, and diagnostics.
  • Label Spacing: Auto-spacing enforces ≥4-bar gaps to prevent text overlap.


Customization & Workflow Notes
  • Adjust ATR/FVG thresholds when volatility shifts.
  • Re-anchor sentiment to your webhook cadence; EMA smoothing (default 5) dampens noise.
  • Reposition the HUD by editing the `table.new` coordinates.
  • Use multiples of the chart timeframe for HTF requests to minimize load.
  • Session inputs accept exchange-local time; align them to your market.


Performance & Compliance
  • Pure Pine v6: Single-line statements, no `lookahead_on`.
  • Resource Safe: Arrays trimmed, boxes limited, `request.security` cached.
  • Repaint Awareness: Signals confirm on close; alerts mirror on-chart logic.
  • Runtime Safety: Arrays/loops guard against `na`.


Use Cases
  • Measure when social sentiment aligns with structure.
  • Plan ICT-style intraday rebalances around session-specific FVG taps.
  • Fade VWAP raids when displacement shows exhaustion.
  • Watch initial balance breaks backed by statistical volume.
  • Keep risk/target references anchored in ATR logic.


Signal Logic Snapshot
  • Social Pulse Long/Short: `sentimentEMA` gated by `sentimentMin`, `volSpike`, EMA 8/21 cross, and `momoComposite` sign agreement. Keeps hype tied to structural follow-through.
  • Kill-Zone FVG Long/Short: Requires session filter, HTF EMA bias alignment, and an active FVG tap (`bullFvgTap` / `bearFvgTap`). Labels include swing stops + ATR targets pulled from `swingLookback` and `liqTargetMultiple`.
  • Local FVG Long/Short: Uses `localBullish` / `localBearish` heuristics (EMA slope, displacement, sequential closes) to surface intraday reversals even when HTF bias has not flipped.
  • VWAP Raids: Detect equal-high/equal-low sweeps (`raidHigh`, `raidLow`) that revert toward `sessionVwap` or rolling VWAP when displacement exceeds `vwapAlertDisplace`.
  • Range Breakouts: Combine `rangeComplete`, breakout confirmation, liquidity spikes, and nearby FVG activity for statistically backed initial balance breaks.
  • Liquidity Spikes: Volume Z-score > `zScoreThreshold` logs direction, size, and timestamp for the HUD and optional review workflows.


Session Logic & VWAP Handling
  • Kill zone + NY session inputs use TradingView’s session strings; `f_inSession()` drives both visual shading and whether FVG taps are tradeable when `killZoneOnly` is true.
  • Session VWAP resets using cumulative price × volume sums that restart when the daily timestamp changes; rolling VWAP falls back to `ta.vwap(hlc3)` for instruments where daily resets are less relevant.
  • Initial balance box (`rangeBars` input) locks once complete, extends forward, and stays on chart to contextualize later liquidity raids or breakouts.


Parameter Reference
  • Trend: `emaFastLen`, `emaSlowLen`, `htfResolution`, `htfEmaLen`, `showEmaRibbon`, `showHtfBiasLine`.
  • Momentum: `tf1`, `tf2`, `tf3`, `rsiLen`, `stochLen`, `stochSmooth`, `heatmapHeight`.
  • Volume/Liquidity: `volLookback`, `volSpikeMult`, `zScoreLen`, `zScoreThreshold`, `equalLookback`.
  • VWAP & Sessions: `vwapMode`, `showVwapLine`, `vwapAlertDisplace`, `killSession`, `nySession`, `showSessionShade`, `rangeBars`.
  • FVG/Risk: `fvgMinTicks`, `fvgLookback`, `fvgMinSpacing`, `killZoneOnly`, `liqTargetMultiple`, `swingLookback`.
  • Visualization Toggles: `showSignalMarkers`, `showHeatmapBand`, `showInfoPanel`, `showStylizedCandles`.


Workflow Recipes
  • Kill-Zone Continuation: During the defined kill session, look for `killFvgLong` or `killFvgShort` arrows that line up with `sentimentValid` and positive `momoComposite`. Use the HUD’s risk readout to confirm SL/TP distances before entering.
  • VWAP Raid Fade: Outside kill zone, track `raidToVwapLong/Short`. Confirm the candle body exceeds the displacement multiplier, and price crosses back toward VWAP before considering reversions.
  • Range Break Monitor: After the initial balance locks, mark `rangeBreakLong/Short` circles only when the momentum band is >0 or <0 respectively and a fresh FVG box sits near price.
  • Liquidity Spike Review: When the HUD shows “Liquidity” timestamps, hover the plotted squares at chart bottom to see whether spikes were buy/sell oriented and if local FVGs formed immediately after.




Metadata
Author: officialjackofalltrades
Platform: TradingView (Pine Script v6)
Category: Sentiment + Liquidity Intelligence

Hope you Enjoy!

Wyłączenie odpowiedzialności

Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.