OPEN-SOURCE SCRIPT

Premium and Discount Pivot Matrix [BigBeluga]

16 285
Premium and Discount Pivot Matrix [BigBeluga] is an advanced market-structure terminal engineered for TradingView. It maps macroeconomic structural equilibrium by tracking historical price extremes and calculating accurate institutional auction zones.

Instead of printing static linear channels, this framework uses an active multi-pivot state matrix to calculate premium ceiling and discount floor boundaries. It pairs these levels with a real-time 100-Bin Volume Profile Matrix plotted directly at the leading edge of the chart, providing immediate clarity on volume distribution relative to the market's fair-value equilibrium.

NIFTY
istantanea

BTCUSDT
istantanea

🔵 CHANNEL CALCULATION METHODOLOGY
The central core of the indicator relies on a multi-layered geometric calculation engine to establish its tracking bands. The engine follows a distinct three-step sequence to construct the structural matrix:

1. Multi-Pivot Array Extraction Engine
  • Asymmetric Window Scanning Nodes: The engine scans the chart for structural price peaks and troughs using an adjustable lookback window (Pivot Left/Right Bars). For a pivot to be verified, it must be the absolute highest or lowest value within that specified bar radius.
  • FIFO Array Storage Matrix: When a high pivot is logged, it is pushed into the highPivots array; low pivots are funneled into the lowPivots array. The script features memory guardrails (Max Pivots to Track) that automatically shift old elements out of memory, limiting array depth to prevent memory allocation drag.


Pine Script®


2. Mathematical Boundary Selection
  • Premium Ceiling Isolation Grid: The terminal continuously runs an evaluation sweep across the active high memory array and extracts the absolute highest peak value using an optimized maximum tracking filter node. This serves as the outer resistance band.
  • Discount Floor Isolation Grid: Concurrently, the engine sweeps the active low memory array to extract the absolute lowest trough value, setting the hard outer support band floor.
  • Step-Line Price Plotting Framework: Because it selects the maximum high and minimum low of a rolling historical lookback set, the boundaries plot on your canvas as clean, structural step-lines. These lines only shift when a new macro extreme is logged or when an older extreme drops out of the tracking array.


3. Dynamic Equilibrium Tracking State Machine
  • Fair Value Midline Matrix: The Equilibrium Midline represents the exact mathematical center of the active trading channel. It calculates the mid-point price by taking the average of the resistance ceiling and support floor arrays.
  • Structural Shifting Trend Cloud Filters: This midline acts as a real-time tracker for the value center of the asset. The internal state machine monitors this line on every tick and applies dynamic visual treatments: it flashes the Midline Rising Color when the value structure is shifting upward, and instantly mutates to the Midline Falling Color when structural value drops downward.


Pine Script®


🔵 CORE STRUCTURAL LAYOUT FEATURES
1. 100-Bin Volume Profile Distribution Matrix
  • Intra-Channel Grid Binning Engine: When enabled (Show Volume Profile at Channel End?), the indicator runs a localized calculation over a specified historical range (Volume Profile Lookback). It divides the vertical space between the resistance ceiling and support floor into 100 equal vertical bins.
  • Adaptive Transparency Histogram Blocks: It calculates the exact volume distribution for each candle across these bins, scaling the horizontal width of the resulting histogram bars (Volume Profile Max Width). Premium distribution bars (above the midline) use an automatic gradient that gets brighter near the resistance ceiling to flag overextended premium supply. Discount distribution bars (below the midline) flash brighter near the support floor to highlight historical institutional accumulation blocks.


2. Volumetric Breakdown & Reversal Markers
  • Boundary Breach Telemetry Glyphs: The terminal closely monitors interactions with the channel boundaries. If a candle breaks completely out of the rolling step-line range, it triggers high-visibility telemetry circle shapes directly on the chart canvas (Bullish Reversal on downward breaks, Bearish Reversal on upward crosses).
  • Time-Index Signal Buffer Guards: To prevent messy clutter, the script suppresses repetitive signals using a strict index tracking buffer rule. When a valid breach is confirmed, it stamps the signal with clean text labels tracking the exact transaction volume traded during the breakout bar.


Pine Script®


🔵 SYSTEMATIC EXECUTION STRATEGIES & RISK INTERPRETATION
  • Premium Zone Reversals: When an asset rallies into the upper channel gradient, enters the PREMIUM zone, and tests the resistance ceiling, monitor the 100-Bin Volume Profile. If the profile shows fading volume bars at the highs, look for short setups targeting a mean-reversion move back down to the Equilibrium Midline.
  • Discount Value Accumulation Trim: When price action drops into the DISCOUNT zone and approaches the channel floor, check the volume profile. Heavy volume concentration at these lows confirms strong institutional interest. Look for long positions here, using the step-line support floor as a strict trade invalidation level.
  • Equilibrium Breakout Continuations: Watch the behavior of the asset when the Equilibrium Midline shifts color. A sharp upward shift in the midline accompanied by a validated volume expansion signature suggests a structural trend shift, opening up long continuation options up to the premium line.


🔵 INTERFACE CONFIGURATION AND PARAMETERS
  • Pivot Structure Configuration Blocks: Adjust left/right bar strengths and internal array memory slots to optimize the indicator for short-term swing scalping or long-term macro trend tracking.
  • Volume Profile Matrix Settings: Fine-tune lookback depths and maximum bar widths to scale the volume profile layout for any financial asset class or chart timeframe.
  • Styling & Visual Aesthetics Overrides: Fully customize colors for rising structures, falling boundaries, interior gradient fills, and background profiles to integrate seamlessly with your preferred light or dark charting interface.


Transform your charting layout from traditional linear indicators into a highly automated, volume-anchored volatility tracking network with the Premium and Discount Pivot Matrix terminal.

Declinazione di responsabilità

Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.