OPEN-SOURCE SCRIPT

gex 1

64
//version=5
indicator("SPY Gamma Levels [2025-10-06]", overlay=true)

// Generated from GEX Scanner at 2025-10-06 16:30 UTC
// Symbol: SPY | Spot: 671.39
// Analysis includes all expirations

// Symbol Validation - Only display levels for correct ticker
expectedSymbol = "SPY"
isCorrectSymbol = syminfo.ticker == expectedSymbol

// Warning System for Wrong Symbol
if not isCorrectSymbol and barstate.islast
warningTable = table.new(position.top_right, 1, 1, bgcolor=color.red, border_width=2)
table.cell(warningTable, 0, 0, "⚠️ WRONG SYMBOL!\nThis script is for " + expectedSymbol + "\nCurrent chart: " + syminfo.ticker, text_color=color.white, bgcolor=color.red, text_size=size.normal)

// Zero Gamma Level
zero_gamma = 471.66

// Max Pain Strike
max_pain = 659.00

// Major Resistance Levels (Negative Gamma)
resistance_1 = 655.00 // GEX: -215M (minor)
resistance_2 = 663.00 // GEX: -104M (minor)
resistance_3 = 668.00 // GEX: -57M (minor)

// Major Support Levels (Positive Gamma)
support_1 = 675.00 // GEX: +708M (moderate)
support_2 = 680.00 // GEX: +595M (moderate)
support_3 = 670.00 // GEX: +458M (minor)

// Plot Key Levels

plot(isCorrectSymbol ? zero_gamma : na, "Zero Gamma", color=color.yellow, linewidth=3, style=plot.style_line)
if isCorrectSymbol and barstate.islast
label.new(bar_index, zero_gamma, "Zero Gamma\n$471.66", color=color.yellow, style=label.style_label_left, textcolor=color.black, size=size.normal)

plot(isCorrectSymbol ? max_pain : na, "Max Pain", color=color.purple, linewidth=2, style=plot.style_circles)
if isCorrectSymbol and barstate.islast
label.new(bar_index, max_pain, "Max Pain\n$659.00", color=color.purple, style=label.style_label_right, textcolor=color.white, size=size.small)

// TOP 3 RESISTANCE LEVELS (Strongest Negative Gamma)
plot(isCorrectSymbol ? resistance_1 : na, "★R1: $655", color=color.red, linewidth=4, style=plot.style_line)
if isCorrectSymbol and barstate.islast
label.new(bar_index, resistance_1, "★R1 (TOP)\n$655\n-215M", color=color.red, style=label.style_label_left, textcolor=color.white, size=size.normal)
plot(isCorrectSymbol ? resistance_2 : na, "★R2: $663", color=color.new(color.red, 20), linewidth=3, style=plot.style_line)
if isCorrectSymbol and barstate.islast
label.new(bar_index, resistance_2, "★R2 (TOP)\n$663\n-104M", color=color.new(color.red, 20), style=label.style_label_left, textcolor=color.white, size=size.normal)
plot(isCorrectSymbol ? resistance_3 : na, "★R3: $668", color=color.new(color.red, 40), linewidth=2, style=plot.style_line)
if isCorrectSymbol and barstate.islast
label.new(bar_index, resistance_3, "★R3 (TOP)\n$668\n-57M", color=color.new(color.red, 40), style=label.style_label_left, textcolor=color.white, size=size.normal)

// TOP 3 SUPPORT LEVELS (Strongest Positive Gamma)
plot(isCorrectSymbol ? support_1 : na, "★S1: $675", color=color.lime, linewidth=4, style=plot.style_line)
if isCorrectSymbol and barstate.islast
label.new(bar_index, support_1, "★S1 (TOP)\n$675\n+708M", color=color.lime, style=label.style_label_right, textcolor=color.black, size=size.normal)
plot(isCorrectSymbol ? support_2 : na, "★S2: $680", color=color.new(color.lime, 20), linewidth=3, style=plot.style_line)
if isCorrectSymbol and barstate.islast
label.new(bar_index, support_2, "★S2 (TOP)\n$680\n+595M", color=color.new(color.lime, 20), style=label.style_label_right, textcolor=color.black, size=size.normal)
plot(isCorrectSymbol ? support_3 : na, "★S3: $670", color=color.new(color.lime, 40), linewidth=2, style=plot.style_line)
if isCorrectSymbol and barstate.islast
label.new(bar_index, support_3, "★S3 (TOP)\n$670\n+458M", color=color.new(color.lime, 40), style=label.style_label_right, textcolor=color.black, size=size.normal)


// ==== TOP 3 GAMMA LEVELS SUMMARY ====
// STRONGEST RESISTANCE (Above $671.39):
// R1: $655.00 | -215M GEX | MINOR
// R2: $663.00 | -104M GEX | MINOR
// R3: $668.00 | -57M GEX | MINOR
// STRONGEST SUPPORT (Below $671.39):
// S1: $675.00 | +708M GEX | MODERATE
// S2: $680.00 | +595M GEX | MODERATE
// S3: $670.00 | +458M GEX | MINOR
// =====================================

// Usage Notes:
// - ★ TOP 3 LEVELS: Thickest lines (4px→3px→2px) with star symbols
// - Resistance levels (red): Negative gamma, potential price ceiling
// - Support levels (lime): Positive gamma, potential price floor
// - Zero Gamma (yellow): Gamma flip point - thicker line for visibility
// - Max Pain (purple): Strike with maximum option value decay
// - Color intensity: Darker = stronger level (top levels are most prominent)
// - Labels show strike prices, GEX values, and ranking for easy reference
// - Focus on TOP 3 levels for key trading decisions
// - Update this indicator throughout the trading day as levels change

คำจำกัดสิทธิ์ความรับผิดชอบ

ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมที่ ข้อกำหนดการใช้งาน