Indicator · Pine Script v6 · On the chart

Gamma Levels v3 Auto

by Timonkru

Gamma Levels Auto plots daily options-derived dealer gamma levels directly on the price chart.

View on GitHub

GitHub stars2on the repository
Pine versionv6current
Lines of code224
Settings17inputs
LicenceMIT
Last update6 weeks ago16 Sep 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

224 lines of Pine Script v6 from GammaLevels_auto.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

GammaLevels_auto.pine
//@version=6
// Gamma Levels v3 (Auto) [KruegerAlgorithms] - AUTO-GENERIERT von build_seed.py (NICHT editieren)
// STRUKTUR-Karte (7-45 DTE) = dicke Linien | NAH-Karte (0-5 DTE) = gepunktet = Tageswetter/Pinning
// v3: Vanna/Charm-Strikes + VIX-Regime im Label (Kontext, unvalidiert - kein Signal).
// Template ist bewusst reines ASCII (die .bat-Rituale kopieren via `clip` = ANSI).
// Taeglich VOR US-Open: `python build_seed.py` -> Datei komplett in den Pine-Editor -> Save.
indicator("Gamma Levels v3 (Auto) [KruegerAlgorithms]", overlay = true)

// ===== TAGES-LEVEL in INDEX-PUNKTEN (auto-generiert 2026-07-15) =====
NQ_FLIP = 29376.03
NQ_CW = 30012.82
NQ_PW = 28984.98
NQ_CW2 = 30259.50
NQ_PW2 = 28779.42
NQ_NCW = 29807.25
NQ_NPW = 30218.39
NQ_NF = 29623.73
NQ_MP = 29519.46
NQ_SPOT = 29740.24
NQ_EM = 429.22
NQ_VAN = 91.25
NQ_VANK = 30259.50
NQ_CHM = -63.58
NQ_CHMK = 30259.50
DOW_FLIP = 51733.75
DOW_CW = 53068.14
DOW_PW = 51065.57
DOW_CW2 = 52567.50
DOW_PW2 = 51666.34
DOW_NCW = 53068.14
DOW_NPW = 52367.24
DOW_NF = 52331.73
DOW_MP = 52267.11
DOW_SPOT = 52669.63
DOW_EM = 433.56
DOW_VAN = 5.36
DOW_VANK = 53068.14
DOW_CHM = -2.45
DOW_CHMK = 53068.14
GOLD_FLIP = 4119.58
GOLD_CW = 4160.60
GOLD_PW = 4040.47
GOLD_CW2 = 4062.31
GOLD_PW2 = 4368.08
GOLD_NCW = 4051.39
GOLD_NPW = 4040.47
GOLD_NF = 4097.19
GOLD_MP = 4149.68
GOLD_SPOT = 4065.70
GOLD_EM = 60.28
GOLD_VAN = -7.85
GOLD_VANK = 4368.08
GOLD_CHM = 4.13
GOLD_CHMK = 4368.08
DAX_FLIP = 25066.04
DAX_CW = 26000.00
DAX_PW = 24000.00
DAX_CW2 = 25400.00
DAX_PW2 = 24500.00
DAX_NCW = 25250.00
DAX_NPW = 24700.00
DAX_NF = 24969.12
DAX_MP = 25000.00
DAX_SPOT = 25147.03
DAX_EM = 227.92
DAX_VAN = 121.71
DAX_VANK = 26000.00
DAX_CHM = -61.95
DAX_CHMK = 24000.00
FTSE_FLIP = 0.00
FTSE_CW = 0.00
FTSE_PW = 0.00
FTSE_CW2 = 0.00
FTSE_PW2 = 0.00
FTSE_NCW = 0.00
FTSE_NPW = 0.00
FTSE_NF = 0.00
FTSE_MP = 0.00
FTSE_SPOT = 0.00
FTSE_EM = 0.00
FTSE_VAN = 0.00
FTSE_VANK = 0.00
FTSE_CHM = 0.00
FTSE_CHMK = 0.00
LEV_DATE = "2026-07-15"
LEV_Y = 2026
LEV_M = 7
LEV_D = 15
// ==================================================================

idx        = input.string("Auto", "Index", options = ["Auto", "NQ", "DOW", "GOLD", "DAX", "FTSE"])
offset     = input.float(0.0, "Manueller Offset (Punkte, Broker-Basis)")
neutralPct = input.float(0.3, "Flip-Zone (+/- %)", minval = 0.05, step = 0.05)
showReg    = input.bool(true, "Regime-Hintergrund (gruen/rot/grau)")

grpS = "STRUKTUR-Karte (7-45 DTE) - stabile Tageslinien"
showFlip = input.bool(true,  "FLIP - gelb, dick",                        group = grpS)
showCW   = input.bool(true,  "CALL-WALL - rot, dick",                    group = grpS)
showPW   = input.bool(true,  "PUT-WALL - gruen, dick",                   group = grpS)
showCW2  = input.bool(true,  "CALL-WALL 2 (Strike-Regal) - rot, gestrichelt",   group = grpS)
showPW2  = input.bool(true,  "PUT-WALL 2 (Strike-Regal) - gruen, gestrichelt",  group = grpS)

grpN = "NAH-Karte (0-5 DTE) - 0DTE-Tageswetter/Pinning"
showNCW  = input.bool(true,  "0DTE CALL-WALL - orange, gepunktet",       group = grpN)
showNPW  = input.bool(true,  "0DTE PUT-WALL - tuerkis, gepunktet",       group = grpN)
showNF   = input.bool(false, "0DTE FLIP - gelb, gepunktet",              group = grpN)

grpX = "Sonstiges"
showEM   = input.bool(true,  "EXPECTED MOVE +/-1 Tag - blau, gepunktet", group = grpX)
showMP   = input.bool(false, "MAX PAIN - grau, gepunktet",               group = grpX)

grpV = "FLOW & VIX (Kontext, unvalidiert - kein Trade-Signal)"
showVanna = input.bool(true,  "VANNA-Strike - violett, gepunktet",       group = grpV)
showCharm = input.bool(true,  "CHARM-Strike - aqua, gepunktet",          group = grpV)
showVix   = input.bool(true,  "VIX-Regime im Label (CBOE:VIX)",          group = grpV)

t = str.upper(syminfo.ticker)
detect() =>
    r = "NONE"
    if str.contains(t,"NAS") or str.contains(t,"US100") or str.contains(t,"USTEC") or str.contains(t,"NDX") or str.contains(t,"USTECH")
        r := "NQ"
    else if str.contains(t,"US30") or str.contains(t,"WS30") or str.contains(t,"DJ") or str.contains(t,"DOW")
        r := "DOW"
    else if str.contains(t,"XAU") or str.contains(t,"GOLD")
        r := "GOLD"
    else if str.contains(t,"GER") or str.contains(t,"DAX") or str.contains(t,"DE40") or str.contains(t,"DE30")
        r := "DAX"
    else if str.contains(t,"UK100") or str.contains(t,"FTSE")
        r := "FTSE"
    r
sel = idx == "Auto" ? detect() : idx

pick(nq, dw, gd, dx, ft) => sel == "NQ" ? nq : sel == "DOW" ? dw : sel == "GOLD" ? gd : sel == "DAX" ? dx : sel == "FTSE" ? ft : 0.0
off(x) => x > 0 ? x + offset : x

flip  = off(pick(NQ_FLIP, DOW_FLIP, GOLD_FLIP, DAX_FLIP, FTSE_FLIP))
cw    = off(pick(NQ_CW,   DOW_CW,   GOLD_CW,   DAX_CW,   FTSE_CW))
pw    = off(pick(NQ_PW,   DOW_PW,   GOLD_PW,   DAX_PW,   FTSE_PW))
cw2   = off(pick(NQ_CW2,  DOW_CW2,  GOLD_CW2,  DAX_CW2,  FTSE_CW2))
pw2   = off(pick(NQ_PW2,  DOW_PW2,  GOLD_PW2,  DAX_PW2,  FTSE_PW2))
ncw   = off(pick(NQ_NCW,  DOW_NCW,  GOLD_NCW,  DAX_NCW,  FTSE_NCW))
npw   = off(pick(NQ_NPW,  DOW_NPW,  GOLD_NPW,  DAX_NPW,  FTSE_NPW))
nflip = off(pick(NQ_NF,   DOW_NF,   GOLD_NF,   DAX_NF,   FTSE_NF))
mp    = off(pick(NQ_MP,   DOW_MP,   GOLD_MP,   DAX_MP,   FTSE_MP))
spotL = pick(NQ_SPOT, DOW_SPOT, GOLD_SPOT, DAX_SPOT, FTSE_SPOT)
em    = pick(NQ_EM,   DOW_EM,   GOLD_EM,   DAX_EM,   FTSE_EM)
van   = pick(NQ_VAN,  DOW_VAN,  GOLD_VAN,  DAX_VAN,  FTSE_VAN)     // Mio USD, Vorzeichen = Dealer-Konvention
vank  = off(pick(NQ_VANK, DOW_VANK, GOLD_VANK, DAX_VANK, FTSE_VANK))
chm   = pick(NQ_CHM,  DOW_CHM,  GOLD_CHM,  DAX_CHM,  FTSE_CHM)
chmk  = off(pick(NQ_CHMK, DOW_CHMK, GOLD_CHMK, DAX_CHMK, FTSE_CHMK))

// ---- VIX-Regime (gestriger Daily-Close = bestaetigt, kein Repaint) ----
// Tertile relativ zu den letzten 250 Handelstagen; Tilt nach validiertem Befund:
// hoch/steigend -> Entscheidungstag (Trend ODER Whipsaw), niedrig/fallend -> Chop.
[vix1, vix2, vp33, vp67] = request.security("CBOE:VIX", "D",
     [close[1], close[2],
      ta.percentile_linear_interpolation(close[1], 250, 33.333),
      ta.percentile_linear_interpolation(close[1], 250, 66.667)],
     ignore_invalid_symbol = true)
vixReg  = na(vix1) or na(vp33) ? "n/a" : vix1 <= vp33 ? "NIEDRIG" : vix1 >= vp67 ? "HOCH" : "MITTEL"
vixDir  = na(vix1) or na(vix2) ? "" : vix1 > vix2 + 0.05 ? "steigt" : vix1 < vix2 - 0.05 ? "faellt" : "flach"
vixTilt = vixReg == "n/a" ? "" :
     (vixReg == "HOCH" or vixDir == "steigt") ? "Entscheidungs-Tilt (Trend/Whipsaw, wenig Chop)" :
     (vixReg == "NIEDRIG" and vixDir != "steigt") ? "Chop-Tilt" : "neutral"

distPct = flip > 0 ? (close - flip) / flip * 100 : na
reg = flip <= 0 ? -99 : math.abs(distPct) < neutralPct ? 0 : distPct > 0 ? 1 : -1
bgcolor(showReg and reg != -99 ? (reg == 1 ? color.new(color.green, 93) : reg == -1 ? color.new(color.red, 93) : color.new(color.gray, 90)) : na)

levTime = timestamp("GMT", LEV_Y, LEV_M, LEV_D, 23, 59)
isStale = (timenow - levTime) > 1000 * 60 * 60 * 36

var line  lF = na, var line lC = na, var line lP = na, var line lC2 = na, var line lP2 = na
var line  lNC = na, var line lNP = na, var line lNF = na, var line lM = na
var line  lE1 = na, var line lE2 = na
var line  lVA = na, var line lCH = na
var label lab = na
if barstate.islast
    line.delete(lF), line.delete(lC), line.delete(lP), line.delete(lC2), line.delete(lP2)
    line.delete(lNC), line.delete(lNP), line.delete(lNF), line.delete(lM)
    line.delete(lE1), line.delete(lE2)
    line.delete(lVA), line.delete(lCH)
    label.delete(lab)
    x1 = bar_index - 400
    if showFlip and flip > 0
        lF := line.new(x1, flip, bar_index, flip, color = color.yellow, width = 2, extend = extend.right)
    if showCW and cw > 0
        lC := line.new(x1, cw, bar_index, cw, color = color.red, width = 2, extend = extend.right)
    if showPW and pw > 0
        lP := line.new(x1, pw, bar_index, pw, color = color.green, width = 2, extend = extend.right)
    if showCW2 and cw2 > 0
        lC2 := line.new(x1, cw2, bar_index, cw2, color = color.new(color.red, 45), width = 1, extend = extend.right, style = line.style_dashed)
    if showPW2 and pw2 > 0
        lP2 := line.new(x1, pw2, bar_index, pw2, color = color.new(color.green, 45), width = 1, extend = extend.right, style = line.style_dashed)
    if showNCW and ncw > 0
        lNC := line.new(x1, ncw, bar_index, ncw, color = color.orange, width = 1, extend = extend.right, style = line.style_dotted)
    if showNPW and npw > 0
        lNP := line.new(x1, npw, bar_index, npw, color = color.teal, width = 1, extend = extend.right, style = line.style_dotted)
    if showNF and nflip > 0
        lNF := line.new(x1, nflip, bar_index, nflip, color = color.new(color.yellow, 35), width = 1, extend = extend.right, style = line.style_dotted)
    if showMP and mp > 0
        lM := line.new(x1, mp, bar_index, mp, color = color.gray, width = 1, extend = extend.right, style = line.style_dotted)
    if showEM and em > 0 and spotL > 0
        lE1 := line.new(x1, spotL + em + offset, bar_index, spotL + em + offset, color = color.new(color.blue, 55), width = 1, extend = extend.right, style = line.style_dotted)
        lE2 := line.new(x1, spotL - em + offset, bar_index, spotL - em + offset, color = color.new(color.blue, 55), width = 1, extend = extend.right, style = line.style_dotted)
    if showVanna and vank > 0
        lVA := line.new(x1, vank, bar_index, vank, color = color.new(color.purple, 40), width = 1, extend = extend.right, style = line.style_dotted)
    if showCharm and chmk > 0
        lCH := line.new(x1, chmk, bar_index, chmk, color = color.new(color.aqua, 45), width = 1, extend = extend.right, style = line.style_dotted)
    regTxt = reg == 1 ? "LONG-GAMMA (Pin/Reversion)" : reg == -1 ? "SHORT-GAMMA (Trend/Amplify)" : reg == 0 ? "FLIP-ZONE (kein Signal)" : "keine Daten"
    flowTxt = (van != 0.0 or chm != 0.0) ?
         "\nVanna " + (van > 0 ? "+" : "") + str.tostring(van, "#.#") + "M (Vol-runter=" + (van > 0 ? "KAUF" : "Verkauf") + ")" + (vank > 0 ? " @" + str.tostring(vank, format.mintick) : "") +
         "  |  Charm " + (chm > 0 ? "+" : "") + str.tostring(chm, "#.#") + "M (" + (chm > 0 ? "Zeit=Kauf-Stuetze" : "Zeit=Verkauf-Druck") + ")" + (chmk > 0 ? " @" + str.tostring(chmk, format.mintick) : "") : ""
    vixTxt = showVix and vixReg != "n/a" ?
         "\nVIX " + str.tostring(vix1, "#.##") + " (" + vixReg + ", " + vixDir + ") -> " + vixTilt : ""
    txt = sel + " - " + regTxt + (flip > 0 ? "  Flip " + str.tostring(flip, format.mintick) + " (" + str.tostring(distPct, "#.##") + "%)" : "") + flowTxt + vixTxt + "\nLevel vom " + LEV_DATE + (isStale ? "  !! VERALTET - build_seed laufen lassen !!" : "")
    lab := label.new(bar_index, high, txt, style = label.style_label_left, color = isStale ? color.new(color.orange, 10) : reg == 1 ? color.new(color.green, 25) : reg == -1 ? color.new(color.red, 25) : color.new(color.gray, 25), textcolor = color.white, size = size.small)

// ===== ALERTS (im Alert-Dialog auswaehlbar) =====
alertcondition(ta.crossover(close, flip),  "Gamma: Flip-Cross UP",   "Spot kreuzt Gamma-Flip nach OBEN -> Richtung Long-Gamma/Pinning")
alertcondition(ta.crossunder(close, flip), "Gamma: Flip-Cross DOWN", "Spot kreuzt Gamma-Flip nach UNTEN -> Short-Gamma/Amplify")
alertcondition(ta.crossunder(close, pw),   "Gamma: Put-Wall BRUCH",  "Put-Wall gebrochen -> Falltuer offen (Amplify-Risiko)")
alertcondition(ta.crossover(close, pw),    "Gamma: Put-Wall RECLAIM", "Put-Wall von unten zurueckerobert -> Umkehr-Signatur (Dealer-Rueckkaeufe)")
alertcondition(ta.crossover(close, cw),    "Gamma: Call-Wall Break UP", "Call-Wall ueberschritten -> meist Magnet/Pin, selten Anschluss")

Overview

Gamma Levels v3 Auto projects structural levels (7 to 45 DTE) and near-term 0DTE levels, including gamma flip zones, call and put walls, max pain, expected move, and Vanna or Charm strikes for major indices and gold. Inputs allow users to select the asset index, apply a manual broker offset, customize visual toggles for different DTE tiers, and display VIX regime context. The indicator relies on static daily snapshots baked into the script rather than live streaming options data.

Details

Published by

Timonkru on GitHub

Type

Indicator, Pine Script v6

Draws

On the price chart

Category

Support & resistance, Volatility & bands

Markets

Indices, Gold

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Topics

dealer-gammagamma-exposuregexmarket-structureoptions-tradingpine-scripttradingview

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
IndexstringAutoidx
Manueller Offset (Punkte, Broker-Basis)float0.0offset
Flip-Zone (+/- %)float0.3neutralPct
Regime-Hintergrund (gruen/rot/grau)booltrueshowReg
FLIP - gelb, dickbooltrueshowFlip
CALL-WALL - rot, dickbooltrueshowCW
PUT-WALL - gruen, dickbooltrueshowPW
CALL-WALL 2 (Strike-Regal) - rot, gestricheltbooltrueshowCW2
PUT-WALL 2 (Strike-Regal) - gruen, gestricheltbooltrueshowPW2
0DTE CALL-WALL - orange, gepunktetbooltrueshowNCW
0DTE PUT-WALL - tuerkis, gepunktetbooltrueshowNPW
0DTE FLIP - gelb, gepunktetboolfalseshowNF
Show all 17 settings
SettingTypeDefaultVariable
EXPECTED MOVE +/-1 Tag - blau, gepunktetbooltrueshowEM
MAX PAIN - grau, gepunktetboolfalseshowMP
VANNA-Strike - violett, gepunktetbooltrueshowVanna
CHARM-Strike - aqua, gepunktetbooltrueshowCharm
VIX-Regime im Label (CBOE:VIX)booltrueshowVix
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

ICT Liquidity Void Fill

by ArunKBhaskar
575 stars

This overlay indicator marks ICT liquidity void fills on the price chart and can show long and short signals. It places a Fibonacci level inside a displacement candle, defaulting to the midpoint, and draws lines in a chosen style. Optional filters limit the fi

Indicator v6 SMC / ICT / price actionSupport & resistance
Updated 1 year ago · MPL-2.0 GitHub repository of ICT Liquidity Void Fill

[RS]Donchian Fans

by ricardosantos79
261 stars

This indicator plots Donchian Channel boundary lines along with dynamic fan projections directly on the price chart. It calculates the highest high, lowest low, and median price over a customizable lookback period. Whenever price establishes a new channel high

Indicator v4 Support & resistanceTrend
Updated 4 years ago · None stated GitHub repository of [RS]Donchian Fans

Snag - VWAP

by dearvn
257 stars

This indicator plots a custom Anchored Volume-Weighted Average Price (VWAP) directly on the price chart along with optional standard deviation bands. Users can anchor the VWAP to standard time periods like sessions, weeks, or months, or to corporate events suc

Indicator v5 Moving averagesVolatility & bands Repaints
Updated 6 weeks ago · None stated GitHub repository of Snag - VWAP

Candlestick Patterns

by harryguiacorn
219 stars

This indicator plots optional candlestick pattern signals on the price chart. It detects engulfing bars, inside bars, HOLP and LOHP, kicker patterns, body-mass extremes, higher highs and lower lows, ATR warnings, and four-bar fractals. Optional pivot marks use

Indicator v5 Candlestick patternsVolatility & bands
Updated 1 year ago · None stated GitHub repository of Candlestick Patterns

Dynamic Linear Regression

by TradersPost
218 stars

Dynamic Linear Regression calculates and plots linear regression trendlines and standard deviation channels directly on the price chart over a user-selected time period. Traders can configure static channels locked at the end time, dynamic channels that contin

Indicator v6 TrendSupport & resistance
Updated 3 months ago · None stated GitHub repository of Dynamic Linear Regression

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers