OPEN-SOURCE SCRIPT
GEX Options Flow Pro 100% free

[GEX Options Flow Pro - Enhanced Options Data Visualizer]
INTRODUCTION
This script is designed to visualize advanced options-derived metrics and levels on TradingView charts, including Gamma Exposure (GEX) walls, gamma flip points, vanna levels, delta-neutral prices (DEX), max pain, implied moves, and more. It overlays dynamic lines, labels, boxes, and an info table to highlight potential support, resistance, volatility regimes, and flow dynamics based on options data.
These visualizations aim to help users understand how options market structure might influence price action, such as areas of potential stability (positive GEX) or volatility (negative GEX). All data is user-provided via pasted strings, as Pine Script cannot fetch external options data directly due to platform limitations (detailed below).
The script is open-source under TradingView's terms, allowing study, modification, and improvement. It draws inspiration from standard options Greeks and exposure metrics (e.g., gamma, vanna, charm) discussed in financial literature like Black-Scholes models and dealer positioning analyses. No external code is copied; all logic is original or based on mathematical formulas.
Disclaimer: This is an educational tool only. It does not provide investment advice, trading signals, or guarantees of performance. Past data is not indicative of future results. Use at your own risk, and combine with your own analysis. Not intended for qualified investors only.
How the Options Levels Are Calculated
Levels are not computed in Pine Script—they rely on pre-calculated values from external tools (e.g., Python scripts using libraries like yfinance for options chains). Here's how they're typically derived externally before pasting into the script:
External tools handle dealer assumptions (e.g., short calls/puts) and scaling (per % move).
Effect as Support and Resistance in Technical Trading
Options levels reflect dealer hedging dynamics:
Combine with TA (e.g., volume, trends). High activity strengthens effects; alerts on crosses/proximities for awareness.
Limitations of the TradingView Platform for Data Pulling
Pine Script is sandboxed:
This ensures lightweight scripts but requires external data sourcing.
Creative Solution for On-Demand Data Pulling
Users can use external tools (e.g., Python scripts with yfinance) to fetch/compute data on demand. Generate a formatted string (ticker,timestamp|term1_data|term2_data|...), paste into inputs. Tools can process multiple tickers, cache for ~15-30 min, and output strings for quick portfolio scanning. Run locally or via custom setups for near-real-time updates without platform violations.
For convenience, a free bot is available on my website that accepts commands like !gex <ticker> to generate both current data strings (for all expiration terms) and historical walls data on demand. This allows users to easily obtain fresh or cached data (refreshed every ~30 min) for pasting into the indicator—ideal for scanning portfolios without manual coding.
Script Functionality Breakdown
Release Notes
Feedback welcome in comments. Educational only—not advice.
INTRODUCTION
This script is designed to visualize advanced options-derived metrics and levels on TradingView charts, including Gamma Exposure (GEX) walls, gamma flip points, vanna levels, delta-neutral prices (DEX), max pain, implied moves, and more. It overlays dynamic lines, labels, boxes, and an info table to highlight potential support, resistance, volatility regimes, and flow dynamics based on options data.
These visualizations aim to help users understand how options market structure might influence price action, such as areas of potential stability (positive GEX) or volatility (negative GEX). All data is user-provided via pasted strings, as Pine Script cannot fetch external options data directly due to platform limitations (detailed below).
The script is open-source under TradingView's terms, allowing study, modification, and improvement. It draws inspiration from standard options Greeks and exposure metrics (e.g., gamma, vanna, charm) discussed in financial literature like Black-Scholes models and dealer positioning analyses. No external code is copied; all logic is original or based on mathematical formulas.
Disclaimer: This is an educational tool only. It does not provide investment advice, trading signals, or guarantees of performance. Past data is not indicative of future results. Use at your own risk, and combine with your own analysis. Not intended for qualified investors only.
How the Options Levels Are Calculated
Levels are not computed in Pine Script—they rely on pre-calculated values from external tools (e.g., Python scripts using libraries like yfinance for options chains). Here's how they're typically derived externally before pasting into the script:
- Fetching Options Data: Retrieve options chain for a ticker: strikes, open interest (OI), volume, implied volatility (IV), expirations (e.g., shortest: 0-7 DTE, short: 7-14 DTE, medium: ~30 DTE, long: ~90 DTE). Get current price and 5-day history for context.
- Gamma Walls (Put/Call Walls): Compute gamma for each option using Black-Scholes: gamma = N'(d1) / (S * σ * √T) where S = spot price, K = strike, T = time to expiration (years), σ = IV, N'(d1) = normal PDF. Aggregate GEX at strikes: GEX = sign * gamma * OI * 100 * S^2 * 0.01 (per 1% move, with sign based on dealer positioning: typically short calls/puts = negative GEX). Put Wall: Highest absolute GEX put strike below S (support via dealer buying on dips). Call Wall: Highest absolute GEX call strike above S (resistance via dealer selling on rallies). Secondary/Tertiary: Next highest levels. Historical walls track tier-1 levels over 5 days.
- Gamma Flip: Net GEX profile across prices: Sum GEX for all options at hypothetical spots. Flip point: Interpolated price where net GEX changes sign (stable above, volatile below).
- Vanna Levels: Vanna = -N'(d1) * d2 / σ. Weighted by OI; highest positive/negative strikes.
- DEX (Delta-Neutral Price): Net dealer delta: Sum (delta * OI * 100 * sign), with delta from Black-Scholes. DEX: Price where net delta = 0 (interpolated).
- Max Pain: Strike minimizing total intrinsic value for all options holders.
- Skew: 25-delta skew: IV difference between 25-delta put and call (interpolated).
- Net GEX/Delta: Total signed GEX/delta at current S.
- Implied Move: ATM IV * √(DTE/365) for 1σ range.
- C/P Ratio: (Call OI + volume) / (Put OI + volume).
- Smart Stop Loss: Below lowest support (e.g., Put Wall, gamma flip), buffered by IV * √(DTE/30).
- Other Metrics: IV: ATM average. 5-day metrics: Avg volume, high/low.
External tools handle dealer assumptions (e.g., short calls/puts) and scaling (per % move).
Effect as Support and Resistance in Technical Trading
Options levels reflect dealer hedging dynamics:
- Put Wall (Gamma Support): High put GEX creates buying pressure on dips (dealers hedge short puts by buying stock). Use for long entries, bounces, or stops below.
- Call Wall (Gamma Resistance): High call GEX leads to selling on rallies. Good for trims, shorts, or reversals.
- Gamma Flip: Pivot for volatility—above: dampened moves (positive GEX, mean reversion); below: amplified trends (negative GEX, momentum).
- Vanna Levels: Sensitivity to IV changes; crosses may signal vol shifts.
- DEX: Dealer delta neutral—bullish if price below with positive delta.
- Max Pain: Price magnet minimizing option payouts.
- Implied Move/Confidence Bands: Expected ranges (1σ/2σ/3σ); breakouts suggest extremes.
- Liquidity Zones: Wall ranges as price magnets.
- Smart Stop Loss: Protective level below supports, IV-adjusted.
- C/P Ratio & Skew: Sentiment (high C/P = bullish; high skew = put demand).
- Net GEX: Positive = low vol strategies (e.g., condors); negative = momentum trades.
Combine with TA (e.g., volume, trends). High activity strengthens effects; alerts on crosses/proximities for awareness.
Limitations of the TradingView Platform for Data Pulling
Pine Script is sandboxed:
- No API calls or internet access (can't fetch options data directly).
- Limited to chart/symbol data; no real-time chains.
- Inputs static per load; manual updates needed.
- Caching not persistent across sessions.
This ensures lightweight scripts but requires external data sourcing.
Creative Solution for On-Demand Data Pulling
Users can use external tools (e.g., Python scripts with yfinance) to fetch/compute data on demand. Generate a formatted string (ticker,timestamp|term1_data|term2_data|...), paste into inputs. Tools can process multiple tickers, cache for ~15-30 min, and output strings for quick portfolio scanning. Run locally or via custom setups for near-real-time updates without platform violations.
For convenience, a free bot is available on my website that accepts commands like !gex <ticker> to generate both current data strings (for all expiration terms) and historical walls data on demand. This allows users to easily obtain fresh or cached data (refreshed every ~30 min) for pasting into the indicator—ideal for scanning portfolios without manual coding.
Script Functionality Breakdown
- Inputs: Data strings (current/historical); term selector (Shortest/Short/Medium/Long); toggles (historical walls, GEX profile, secondaries, vanna, table, max pain, DEX, stop loss, implied move, liquidity, bands); colors/styles.
- Parsing: Extracts term-specific data; validates ticker match; gets timestamp for freshness.
- Drawing: Dynamic lines/labels (width/color by GEX strength); boxes (moves, zones, bands); clears on updates.
- Info Table: Dashboard with status (freshness emoji), Greeks (GEX/delta with emojis), vol (IV/skew), levels (distances), flow (C/P, vol vs 5D).
- Historical Walls: Displays past tier-1 walls on daily+ timeframes.
- Alerts: 20+ conditions (e.g., near/cross walls, GEX sign change, high IV).
- Performance: Efficient for real-time; smart label positioning.
Release Notes
- Initial release: Full features including multi-term support, enhanced table with emojis/sentiment, dynamic visuals, smart stop loss.
- Data String Format: TICKER,TIMESTAMP|TERM1_DATA|TERM2_DATA|TERM3_DATA|TERM4_DATA Where each TERM_DATA = val0,val1,...,val30 (31 floats: current_price, prev_close, call_wall_1, call_wall_1_gex, ..., low_5d). Historical: TICKER|TERM1_HIST|... where TERM_HIST = date:cw,pw;date:cw,pw;...
Feedback welcome in comments. Educational only—not advice.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
Dad, trader, technologist, cyclist, and a modern stoic who loves dachshunds, espresso and landscape photography in no particular order.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
Dad, trader, technologist, cyclist, and a modern stoic who loves dachshunds, espresso and landscape photography in no particular order.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.