PROTECTED SOURCE SCRIPT
Updated

GEX History [Lite] Multi-Expiry Gamma Profile Swing Timeline

543
Recommended timeframe : 1D

See how the gamma environment evolved across expiration horizons—not only where one profile is now.

GEX History converts recorded options-derived gamma structures into five synchronized state timelines in a dedicated lower pane. It compares chart close with the P1, pTrans, HVL, cTrans and C1 levels stored for First Expiry, W1, M1, M2 and ALL profiles.

The result is a compact historical map designed to answer:
  • Which expiration horizon changed state first?
  • Did short-dated and longer-dated profiles agree?
  • Was an extension isolated to one profile or broad across several profiles?
  • How long did an aligned or mixed structure persist?


The indicator does not generate entries, exits or price targets. It classifies price location inside each recorded gamma profile so users can combine that context with price action, volume, volatility and their own analysis.

Available for 250+ liquid U.S. market symbols and supported mapped charts, including major index futures, metals and selected crypto pairs.

SUPPORTED-SYMBOL WATCHLIST:
tradingview.com/watchlists/156511666/

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔒 LITE VERSION — IMPORTANT LIMITATION
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
GEX History Lite displays older color-classified history for study, while the latest seven calendar days are reserved.

In that recent window:
  • All five selected rows are displayed as thick orange lines.
  • The current profile-state colors are not revealed.
  • Orange line-end labels are placed at the last classified bar; their hover tooltips report the delayed state.
  • State-colored dotted guides are not drawn anywhere in Lite.

The orange area is a data-access boundary. It is not a gamma state, warning signal, bullish condition or bearish condition.
The Lite indicator version is there so you can learn from the past, but the last 7 days of data are intentionally hidden (so this is not a bug — it’s a feature).
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

🌑 DOCUMENTATION
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

🔶 WHY THIS INDICATOR IS DIFFERENT
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Many gamma tools focus on a single current profile or place numerous levels directly over price. GEX History serves a different purpose: it preserves the state of multiple expiration horizons through time in one lower pane.

Its distinct functionality includes:
  • Five synchronized expiration-profile timelines
  • A six-state Gamma Classification Engine based on five structural levels
  • Different snapshot handling for First Expiry and longer horizons
  • Cross-expiry comparison without covering the price chart
  • Automatic routing and historical conversion for supported mapped instruments
  • Optional IVR, IVx, five-day IVx change, call/put pricing skew and data-freshness cells


This is not a combination of common chart indicators. The classifications depend on externally prepared options-derived profile data and dedicated historical feeds.

🧭 THE FIVE PROFILE HORIZONS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Rows are ordered from the shortest available horizon to the broadest:
  • 0 — First Expiry: the shortest available expiration; normally 0DTE when a same-day profile exists
  • W1 — First Weekly: the nearest selected weekly expiration profile
  • M1 — First Monthly: the nearest standard monthly expiration profile
  • M2 — Second Monthly: the following standard monthly expiration profile
  • ALL — Every Expiry: the broad cumulative expiration structure


Each profile can be enabled independently. Disabled rows disappear and the remaining rows close the gaps automatically. The row height is categorical only; it does not measure gamma magnitude.

🧮 HOW THE GAMMA CLASSIFICATION ENGINE WORKS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
For every enabled horizon, the engine compares chart price with five recorded structural levels:
P1 → pTrans → HVL → cTrans → C1

  • P1: primary put-side wall
  • pTrans: put-side transition level
  • HVL: central volatility-regime pivot
  • cTrans: call-side transition level
  • C1: primary call-side wall


These externally supplied, provider-defined boundaries divide each profile into six model location states. The Pine script does not calculate the boundaries from TradingView chart data. POS and NEG are names for price-location regions in this model; they are not independent measurements of actual dealer inventory. The script uses five customizable colors because NEG_TRANSITION and POS_TRANSITION intentionally share one transition color.
snapshot
🟢 POS_EXTENSION
Price is at or above C1 and at or above cTrans.

The engine labels this region as upper extension territory beyond the primary call wall. It is a location classification, not a measurement of hedging strength and not a reversal or continuation signal.

🟩 POS
Price is at or above HVL and at or above cTrans, but below C1.

The engine labels this region POS. The model interpretation associates this area with more stabilizing conditions, but the label does not establish actual dealer inventory or guarantee damping or mean reversion.

🔷 POS_TRANSITION
Price is at or above HVL but below cTrans.

Gamma is weakly positive. Conditions lean stabilizing, but price remains near the central transition structure and can move back across HVL.

🔷 NEG_TRANSITION
Price is below HVL but above pTrans.

Gamma is weakly negative. Hedging amplification can begin to build, but price has not entered the fully put-dominated region.

🟥 NEG
Price is below HVL and at or below pTrans, but above P1.

The engine labels this region NEG. The model interpretation associates this area with greater amplification risk, but the label does not establish actual dealer inventory or predict volatility or continuation.

🔴 NEG_EXTENSION
Price is at or below P1 and at or below pTrans.

The engine labels this region as lower extension territory beyond the primary put wall. It identifies location beyond supplied boundaries; it does not measure hedging strength, predict the next bar or guarantee further downside.

POS_EXTENSION and NEG_EXTENSION use larger circles so outer-wall events are easier to identify. Larger points indicate classification type—not trade quality, confidence or expected return.

🚀 BROAD POSITIVE EXTENSION EXAMPLE
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
snapshot
When several horizons enter POS_EXTENSION together, the upper extension is broad across the expiration structure.

The word broad refers to the number of agreeing profiles. It does not mean price must continue higher or reverse lower.

This period is selected only to demonstrate how the classification is rendered. It is not representative of event frequency, trading performance or predictive reliability.

🚨 BROAD NEGATIVE EXTENSION EXAMPLE
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
snapshot
When several horizons enter NEG_EXTENSION together, the lower extension is broad across the expiration structure.

The model associates this region with greater amplification risk, but the chart must not be presented as proof that every NEG_EXTENSION produces a selloff.

This period is selected only to demonstrate how the classification is rendered. It is not representative of event frequency, trading performance or predictive reliability.

🔗 CROSS-EXPIRY CONFLUENCE
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Confluence means multiple horizons hold the same or closely related classification at the same time.

Examples:
  • All five rows are POS or POS_EXTENSION.
  • All five rows are NEG or NEG_EXTENSION.
  • Short and long horizons move through transition together.


The indicator does not calculate a separate confluence score. Confluence is a visual interpretation of agreement among the displayed rows.

This period is selected only to demonstrate visual agreement among profiles. It is not a confidence score or evidence of predictive reliability.

↔️ MIXED / DIVERGENT STRUCTURE
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
snapshot
A mixed structure appears when expiration horizons disagree.

Examples:
  • 0 and W1 are negative while M1, M2 and ALL remain positive.
  • The first expiry reaches an extension while monthly profiles stay in transition.
  • ALL changes after shorter profiles have already moved.


This disagreement can reveal which part of the expiration structure is changing first. It is context, not an automatic bullish or bearish signal.

This period is selected only to demonstrate cross-horizon disagreement. It is not a trading-performance sample.

🕒 SNAPSHOT METHODOLOGY
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
The profiles do not all use the same snapshot.

First Expiry / 0DTE

When a same-day expiration is available, its profile is recorded from the 6:30 AM ET premarket state. That fixed structure is then evaluated against price during the trading session.

W1, M1, M2 and ALL

These horizons use the recorded end-of-day GEX profile assigned to the applicable trading date. On historical intraday bars, that date’s EOD structure is used descriptively across the date. It must not be interpreted as a point-in-time backtest proving that the completed EOD snapshot was available earlier in that session.

This separation makes the different observation times explicit and avoids presenting all five horizons as if they came from one identical snapshot.

✨ HOW TO READ THE TIMELINE
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Focus on four dimensions:
  • Color: the classified gamma state
  • Duration: how long the state persisted
  • Sequence: which horizon changed first
  • Breadth: how many horizons agreed


Normal states use compact colored circles. Extension states use larger circles. Optional profile labels appear at the line ends and include hover explanations for the profile, snapshot source and latest available state. Where supported by the publication version, dotted guides connect the latest point with its label.

📊 OPTIONAL IVR INFORMATION PANEL
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
The floating information strip is configurable cell by cell.

Available cells:
  • IVR: current implied-volatility rank relative to its 52-week range
  • IVx avg: average of VIX-style per-expiration IVx estimates across the 35–70 DTE monthly cycle, through the displayed optimal DTE
  • IVx 5d chng %: five-trading-day change in the IVx average
  • Call/Put pricing skew: percentage premium difference between calls and puts measured at equal positive and negative expected-move distances for the displayed optimal monthly expiration
  • Last refreshed: elapsed time since the most recent scheduled data refresh, with script-version details in its tooltip


Only Last refreshed is enabled by default. Users can enable any combination of the other cells. If every cell is disabled, the panel is removed.

Panel settings include:
  • Nine screen positions or HIDE
  • S, M and L sizes
  • A compact horizontal layout that uses only the enabled cells


IVR, IVx and skew describe volatility and option-pricing context. They do not forecast direction by themselves.

🔃 SCHEDULED DATA DELIVERY
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
No manual chart refresh is normally required. The external data feed is scheduled to update on TradingView:
  • Around 6:50 AM ET for the premarket package
  • Approximately 15 minutes after the 9:30 AM ET open
  • Every 1.5–3 hours during U.S. market hours
  • Around ten minutes before the market close


These times reflect TradingView external-data scheduling. They are not tick-by-tick option-chain updates. The panel’s Last refreshed cell reports the most recently received package.

🇺🇸 SYMBOL COVERAGE
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
The historical feed covers more than 250 liquid U.S. indices, ETFs and equities when valid profile data exists.

Examples include:
  • SPX, NDX, RUT, SPY, QQQ and IWM
  • AAPL, AMZN, META, MSFT, NVDA and TSLA
  • DIA, GLD, SLV, IBIT and ETHA


Not every symbol has a valid 0DTE profile every day. A missing profile remains unavailable rather than being replaced with a fabricated state.

🌎 FUTURES, CFD, METALS AND CRYPTO MAPPING
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Supported derivative charts use a related liquid U.S. options profile and a daily conversion factor.

  • /ES and /MES ← SPX profile
  • /NQ and /MNQ ← QQQ profile
  • /YM and /MYM ← DIA profile
  • /RTY and /M2K ← IWM profile
  • /GC and /MGC ← GLD profile
  • /SI and supported silver derivatives ← SLV profile
  • BTCUSD / BTCUSDT ← IBIT profile
  • ETHUSD / ETHUSDT ← ETHA profile
  • XAUUSD ← GLD profile
  • XAGUSD ← SLV profile
  • XSP ← SPX profile at a fixed 0.1 scale
  • Supported S&P 500 and Nasdaq-100 CFD aliases ← corresponding index profile


Mapped levels are scaled to the chart instrument and rounded to the script’s mapped tick size for that instrument class. They remain derived from the listed options-chain underlying; they are not presented as the native options chain of the futures, CFD, metal or crypto instrument.

⚙️ SETTINGS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Profiles to track
  • First Expiry
  • First Weekly
  • First Monthly
  • Second Monthly
  • Every Expiry

All five are enabled by default.

Display & Info Panel Settings
  • Show or hide current-state labels and dotted guides
  • Choose information-panel position or HIDE
  • Choose S, M or L panel size; M is the default
  • Enable IVR, IVx avg, IVx five-day change and Call/Put pricing skew independently
  • Enable or disable Last refreshed; this is the only panel cell enabled by default


Style

Customize NEG_EXTENSION, NEG, Transition, POS and POS_EXTENSION colors. Both transition classifications share the Transition color.

Data

History bars to load controls requested historical depth from 60 to 1,000 bars. The default is 260, approximately one U.S. trading year. More history requires more processing and may take longer to load.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔐 LITE DISPLAY DETAILS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
GEX History Lite

Lite keeps the older classified timeline available while displaying the latest seven calendar days as orange reserved lines. Orange line-end labels are anchored at the last classified bar, and their hover tooltips report that delayed state. The orange region is not a gamma classification.

In Lite, the bottom-right corner is reserved for the recent-window notice. If Bottom Right is selected for the information panel, it is placed at Middle Right instead.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

🎯 PRACTICAL WORKFLOWS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Intraday / short-dated context

Enable 0, W1 and ALL. Compare the fixed First Expiry premarket profile with the nearest weekly and broad aggregate structures.

Monthly / swing context

Enable W1, M1, M2 and ALL. Look for persistent alignment, a transition that spreads from front to back, or disagreement that remains isolated to one horizon.

Mapped futures context

Use the supported futures chart directly. The script routes the applicable options-derived profile and daily conversion factor automatically when both are available.

Historical review

Study transitions around known market events without treating hindsight as a performance test. Compare duration, sequence and breadth rather than selecting only favorable examples.

⏱️ TIMEFRAME COMPATIBILITY
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Supported chart timeframes:
  • Intraday time-based charts
  • 1D charts


Intraday states are displayed during the 6:30 AM–4:00 PM ET window. Weekly and higher chart timeframes are unsupported because they cannot preserve the intended daily profile sequence.

For a compact historical view, use 1D. For intraday development against the fixed daily profile, use a standard time-based intraday chart.

⚠️ IMPORTANT LIMITATIONS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  • A gamma state describes price location relative to a recorded profile; it does not predict the next move.
  • POS and NEG are model region names and do not independently verify actual dealer inventory.
  • A POS label does not guarantee mean reversion, and a NEG label does not guarantee continuation.
  • POS_EXTENSION and NEG_EXTENSION are structural location states—not standalone squeeze, reversal or breakout signals.
  • Cross-expiry confluence is visual agreement, not a computed confidence score.
  • A mixed structure can persist and does not identify which horizon will ultimately lead.
  • Scheduled external data is not tick-by-tick and can be delayed or temporarily unavailable.
  • Snapshot values can differ from other providers because sources, observation times and methodologies differ.
  • Mapped instruments inherit basis and conversion-factor risk relative to the source options profile.
  • Missing or invalid source data produces no classification rather than an estimated state.
  • Historical examples are descriptive and are not strategy backtests or evidence of future performance.


📜 DISCLAIMER
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
This indicator is intended for informational, educational and decision-support purposes only.

It is not investment advice, a trade recommendation, a solicitation, a guarantee of accuracy or a promise of future performance. Options, futures, leveraged products and crypto assets involve substantial risk and are not suitable for every trader.

Users are responsible for independently validating the information, understanding the instrument they trade and making their own informed decisions. The script author accepts no liability for trading losses, data interruptions, mapping differences, calculation errors or decisions made using the indicator.


🚀 QUICK START
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  1. Open a supported symbol on a standard intraday or 1D chart.
  2. Keep all five profiles enabled for the complete expiration view.
  3. Use the line-end labels and their tooltips to identify each horizon and state.
  4. Enable only the information-panel cells you need; Last refreshed is on by default.
  5. Read color as classification, duration as persistence, sequence as leadership and breadth as agreement.
  6. Confirm all observations with price action, volume, volatility and your own risk framework.

Release Notes
fix
Release Notes
bugfix

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.