Options Gamma Study For ThinkOrSwim

Would it be possible to take the code below that I have on the options chain and build a lower study that would show the change in gamma for the highlighted Strikes for 0DTE? Even if I had to change the date each day in the code to get it to pull the data? I would want this for SPX and SPY so I could see change in gamma on the chart without having to open up the options chain. I view this every day to get an idea of the gamma wall that may be support or resistance. What I have noticed is that on the SPX if gamma is call heavy then it most likely goes up and those strikes are ITM at end of day. And on SPY just the opposite. Seems to be more of a contrarian indicator on SPY and a direction on SPX. But only 0DTE matters.

CODE
# Gamma Exposure at each strike is calculated by the formula option gamma * open interest * 100 (calls, x-100 for puts)

plot data = if IsPut() then gamma() * -100 * open_interest() else gamma() * 100 * open_interest();
assignbackgroundcolor(if AbsValue(data) > 2000 then createcolor(250,150,100) else color.black);
data.assignvaluecolor(if AbsValue(data) > 2000 then color.black else color.current);
15176[/ATTACH]']
Ua5aYVo.jpg
 

Attachments

  • Ua5aYVo.jpg
    Ua5aYVo.jpg
    448.8 KB · Views: 3,851
have you used GEX to assist with trades. I am doing some research to understand how and when to apply it to trading. If so, can you give me your opinion using Gamma.
 
Last edited by a moderator:

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Would it be possible to take the code below that I have on the options chain and build a lower study that would show the change in gamma for the highlighted Strikes for 0DTE? Even if I had to change the date each day in the code to get it to pull the data? I would want this for SPX and SPY so I could see change in gamma on the chart without having to open up the options chain. I view this every day to get an idea of the gamma wall that may be support or resistance. What I have noticed is that on the SPX if gamma is call heavy then it most likely goes up and those strikes are ITM at end of day. And on SPY just the opposite. Seems to be more of a contrarian indicator on SPY and a direction on SPX. But only 0DTE matters.

CODE
# Gamma Exposure at each strike is calculated by the formula option gamma * open interest * 100 (calls, x-100 for puts)

plot data = if IsPut() then gamma() * -100 * open_interest() else gamma() * 100 * open_interest();
assignbackgroundcolor(if AbsValue(data) > 2000 then createcolor(250,150,100) else color.black);
data.assignvaluecolor(if AbsValue(data) > 2000 then color.black else color.current);
15176[/ATTACH]']View attachment 15177
not sure if this is what you are looking for - https://tos.mx/!77yreB7y Gamma exposure changes can’t be directly measured on ThinkOrSwim charts, but they can be approximated by how the market maker’s hedge needs shift as price moves.
We’ll simulate that using by the following-
  • Price velocity → rate of price change (ΔPrice)
  • Volume → magnitude of participation
  • Volatility (ATR) → sensitivity scaling
  • Delta approximation → sign and acceleration of price moves
  • Then we’ll blend them into a gamma pressure score that oscillates between positive (bullish gamma push) and negative (bearish gamma unwind).
1761639748709.png
 
Would it be possible to take the code below that I have on the options chain and build a lower study that would show the change in gamma for the highlighted Strikes for 0DTE? Even if I had to change the date each day in the code to get it to pull the data? I would want this for SPX and SPY so I could see change in gamma on the chart without having to open up the options chain. I view this every day to get an idea of the gamma wall that may be support or resistance. What I have noticed is that on the SPX if gamma is call heavy then it most likely goes up and those strikes are ITM at end of day. And on SPY just the opposite. Seems to be more of a contrarian indicator on SPY and a direction on SPX. But only 0DTE matters.

CODE
# Gamma Exposure at each strike is calculated by the formula option gamma * open interest * 100 (calls, x-100 for puts)

plot data = if IsPut() then gamma() * -100 * open_interest() else gamma() * 100 * open_interest();
assignbackgroundcolor(if AbsValue(data) > 2000 then createcolor(250,150,100) else color.black);
data.assignvaluecolor(if AbsValue(data) > 2000 then color.black else color.current);
15176[/ATTACH]']View attachment 15177
I have another but it kinda uses the same work arounds https://tos.mx/!XYFQ8vKC
1761640058842.png
 
@TexasState @Kitchasap
Here is an enhanced version of the Gamma_Delta_Oscillator with enhance price action trending with labels
Code:
# antwerks enhanced 12/14/2025
declare lower;

#------------------ Inputs ------------------
input priceLength       = 5;    # lookback for price ROC (Delta proxy)
input ivLength          = 5;    # lookback for IV ROC (Gamma proxy)
input smooth            = 3;    # smoothing of divergence
input extremeLookback   = 20;   # window for "extreme" pivots
input showBubbles       = yes;  # value bubbles at extremes
input showArrows        = yes;  # arrows at extremes
input bandMult          = 2.0;  # threshold band multiplier (std dev)
input maLength          = 20;   # moving average for price action label
input tradeSignalMA     = 10;   # MA for trade signal integration

#------------------ Manual ROC Definitions ------------------
def priceROC = if close[priceLength] != 0
               then (close - close[priceLength]) / close[priceLength] * 100
               else 0;

def iv = imp_volatility();
def ivROC = if iv[ivLength] != 0
            then (iv - iv[ivLength]) / iv[ivLength] * 100
            else 0;

#------------------ Divergence ------------------
def rawDiv   = ivROC - priceROC;
def osc      = Average(rawDiv, smooth);

#------------------ Threshold Bands ------------------
def oscMean  = Average(osc, extremeLookback);
def oscStd   = StDev(osc, extremeLookback);
def upperBandVal = oscMean + bandMult * oscStd;
def lowerBandVal = oscMean - bandMult * oscStd;

plot UpperBand = upperBandVal;
UpperBand.SetDefaultColor(Color.LIGHT_GRAY);
UpperBand.SetStyle(Curve.SHORT_DASH);

plot LowerBand = lowerBandVal;
LowerBand.SetDefaultColor(Color.LIGHT_GRAY);
LowerBand.SetStyle(Curve.SHORT_DASH);

#------------------ Plots --------------------
plot ZeroLine = 0;
ZeroLine.SetDefaultColor(Color.GRAY);

plot Oscillator = osc;
Oscillator.AssignValueColor(
    if osc > upperBandVal then Color.CYAN
    else if osc < lowerBandVal then Color.MAGENTA
    else if osc > 0 then Color.GREEN
    else Color.RED);
Oscillator.SetLineWeight(2);

plot Hist = osc;
Hist.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Hist.AssignValueColor(
    if osc > upperBandVal then Color.CYAN
    else if osc < lowerBandVal then Color.MAGENTA
    else if osc > 0 then Color.DARK_GREEN
    else Color.DARK_RED);
Hist.SetLineWeight(3);

#------------------ Extreme Pivots ------------------
def hiN = Highest(osc, extremeLookback);
def loN = Lowest(osc, extremeLookback);

def newHigh = osc == hiN and osc[1] < hiN[1];
def newLow  = osc == loN and osc[1] > loN[1];

plot HighArrow = if showArrows and newHigh then osc else Double.NaN;
HighArrow.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
HighArrow.SetLineWeight(3);
HighArrow.SetDefaultColor(Color.RED);

plot LowArrow = if showArrows and newLow then osc else Double.NaN;
LowArrow.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
LowArrow.SetLineWeight(3);
LowArrow.SetDefaultColor(Color.GREEN);

AddChartBubble(showBubbles and newHigh, osc,
               "New " + extremeLookback + "-bar HIGH\n" + Round(osc, 2),
               Color.RED, yes);

AddChartBubble(showBubbles and newLow, osc,
               "New " + extremeLookback + "-bar LOW\n" + Round(osc, 2),
               Color.GREEN, no);

#------------------ Alerts ------------------
Alert(osc crosses above 0, "Oscillator crossed above zero", Alert.BAR, Sound.Ring);
Alert(osc crosses below 0, "Oscillator crossed below zero", Alert.BAR, Sound.Bell);
Alert(osc crosses above upperBandVal, "Oscillator crossed above upper band", Alert.BAR, Sound.Chimes);
Alert(osc crosses below lowerBandVal, "Oscillator crossed below lower band", Alert.BAR, Sound.Ding);

#------------------ Trade Signal Integration ------------------
def priceMA = Average(close, tradeSignalMA);
def tradeLong = osc crosses above 0 and close > priceMA;
def tradeShort = osc crosses below 0 and close < priceMA;

plot TradeLongSignal = if tradeLong then osc else Double.NaN;
TradeLongSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
TradeLongSignal.SetDefaultColor(Color.BLUE);
TradeLongSignal.SetLineWeight(4);

plot TradeShortSignal = if tradeShort then osc else Double.NaN;
TradeShortSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
TradeShortSignal.SetDefaultColor(Color.ORANGE);
TradeShortSignal.SetLineWeight(4);

#------------------ Price Action Labels ------------------
def mainMA = Average(close, maLength);
def newHighPrice = close == Highest(close, extremeLookback);
def newLowPrice  = close == Lowest(close, extremeLookback);

AddLabel(yes,
    if newHighPrice then "Price: " + extremeLookback + "-bar High Breakout"
    else if newLowPrice then "Price: " + extremeLookback + "-bar Low Breakdown"
    else if close > mainMA then "Price Above " + maLength + "MA (Uptrend)"
    else "Price Below " + maLength + "MA (Downtrend)",
    if newHighPrice then Color.GREEN else if newLowPrice then Color.RED else if close > mainMA then Color.LIGHT_GREEN else Color.LIGHT_RED);
def fastMA = Average(close, 10);
def slowMA = Average(close, 30);
def trendUp = fastMA > slowMA;
def trendDown = fastMA < slowMA;

AddLabel(yes,
    if trendUp then "TREND: Bullish"
    else if trendDown then "TREND: Bearish"
    else "TREND: Neutral",
    if trendUp then Color.GREEN
    else if trendDown then Color.RED
    else Color.GRAY);

#------------------ Oscillator Regime Labels ------------------
def pctAboveZero = 100 * Average( if osc > 0 then 1 else 0, extremeLookback);
AddLabel(yes,
         "Div %>0 (" + extremeLookback + "): " + AsPercent(pctAboveZero/100),
         if pctAboveZero >= 70 then Color.GREEN
         else if pctAboveZero <= 30 then Color.RED
         else Color.YELLOW);

AddLabel(yes,
         if osc > 0 then "Hedging Pressure UP (Vol Expansion Likely)"
         else "Calmer Regime / Trend Continuation",
         if osc > 0 then Color.GREEN else Color.RED);

#------------------ Trade Signal Labels ------------------
AddLabel(tradeLong, "Trade Signal: LONG", Color.BLUE);
AddLabel(tradeShort, "Trade Signal: SHORT", Color.ORANGE);

AddLabel(yes,
    if osc > 0 and trendUp then "Market Bias: Bullish (Momentum + Trend)"
    else if osc < 0 and trendDown then "Market Bias: Bearish (Momentum + Trend)"
    else if osc > 0 then "Volatility Pressure ↑ (Watch for breakout)"
    else "Neutral/Choppy",
    if osc > 0 and trendUp then Color.GREEN
    else if osc < 0 and trendDown then Color.RED
    else Color.YELLOW);
 
@TexasState @Kitchasap
Here is an enhanced version of the Gamma_Delta_Oscillator with enhance price action trending with labels
Code:
# antwerks enhanced 12/14/2025
declare lower;

#------------------ Inputs ------------------
input priceLength       = 5;    # lookback for price ROC (Delta proxy)
input ivLength          = 5;    # lookback for IV ROC (Gamma proxy)
input smooth            = 3;    # smoothing of divergence
input extremeLookback   = 20;   # window for "extreme" pivots
input showBubbles       = yes;  # value bubbles at extremes
input showArrows        = yes;  # arrows at extremes
input bandMult          = 2.0;  # threshold band multiplier (std dev)
input maLength          = 20;   # moving average for price action label
input tradeSignalMA     = 10;   # MA for trade signal integration

#------------------ Manual ROC Definitions ------------------
def priceROC = if close[priceLength] != 0
               then (close - close[priceLength]) / close[priceLength] * 100
               else 0;

def iv = imp_volatility();
def ivROC = if iv[ivLength] != 0
            then (iv - iv[ivLength]) / iv[ivLength] * 100
            else 0;

#------------------ Divergence ------------------
def rawDiv   = ivROC - priceROC;
def osc      = Average(rawDiv, smooth);

#------------------ Threshold Bands ------------------
def oscMean  = Average(osc, extremeLookback);
def oscStd   = StDev(osc, extremeLookback);
def upperBandVal = oscMean + bandMult * oscStd;
def lowerBandVal = oscMean - bandMult * oscStd;

plot UpperBand = upperBandVal;
UpperBand.SetDefaultColor(Color.LIGHT_GRAY);
UpperBand.SetStyle(Curve.SHORT_DASH);

plot LowerBand = lowerBandVal;
LowerBand.SetDefaultColor(Color.LIGHT_GRAY);
LowerBand.SetStyle(Curve.SHORT_DASH);

#------------------ Plots --------------------
plot ZeroLine = 0;
ZeroLine.SetDefaultColor(Color.GRAY);

plot Oscillator = osc;
Oscillator.AssignValueColor(
    if osc > upperBandVal then Color.CYAN
    else if osc < lowerBandVal then Color.MAGENTA
    else if osc > 0 then Color.GREEN
    else Color.RED);
Oscillator.SetLineWeight(2);

plot Hist = osc;
Hist.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Hist.AssignValueColor(
    if osc > upperBandVal then Color.CYAN
    else if osc < lowerBandVal then Color.MAGENTA
    else if osc > 0 then Color.DARK_GREEN
    else Color.DARK_RED);
Hist.SetLineWeight(3);

#------------------ Extreme Pivots ------------------
def hiN = Highest(osc, extremeLookback);
def loN = Lowest(osc, extremeLookback);

def newHigh = osc == hiN and osc[1] < hiN[1];
def newLow  = osc == loN and osc[1] > loN[1];

plot HighArrow = if showArrows and newHigh then osc else Double.NaN;
HighArrow.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
HighArrow.SetLineWeight(3);
HighArrow.SetDefaultColor(Color.RED);

plot LowArrow = if showArrows and newLow then osc else Double.NaN;
LowArrow.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
LowArrow.SetLineWeight(3);
LowArrow.SetDefaultColor(Color.GREEN);

AddChartBubble(showBubbles and newHigh, osc,
               "New " + extremeLookback + "-bar HIGH\n" + Round(osc, 2),
               Color.RED, yes);

AddChartBubble(showBubbles and newLow, osc,
               "New " + extremeLookback + "-bar LOW\n" + Round(osc, 2),
               Color.GREEN, no);

#------------------ Alerts ------------------
Alert(osc crosses above 0, "Oscillator crossed above zero", Alert.BAR, Sound.Ring);
Alert(osc crosses below 0, "Oscillator crossed below zero", Alert.BAR, Sound.Bell);
Alert(osc crosses above upperBandVal, "Oscillator crossed above upper band", Alert.BAR, Sound.Chimes);
Alert(osc crosses below lowerBandVal, "Oscillator crossed below lower band", Alert.BAR, Sound.Ding);

#------------------ Trade Signal Integration ------------------
def priceMA = Average(close, tradeSignalMA);
def tradeLong = osc crosses above 0 and close > priceMA;
def tradeShort = osc crosses below 0 and close < priceMA;

plot TradeLongSignal = if tradeLong then osc else Double.NaN;
TradeLongSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
TradeLongSignal.SetDefaultColor(Color.BLUE);
TradeLongSignal.SetLineWeight(4);

plot TradeShortSignal = if tradeShort then osc else Double.NaN;
TradeShortSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
TradeShortSignal.SetDefaultColor(Color.ORANGE);
TradeShortSignal.SetLineWeight(4);

#------------------ Price Action Labels ------------------
def mainMA = Average(close, maLength);
def newHighPrice = close == Highest(close, extremeLookback);
def newLowPrice  = close == Lowest(close, extremeLookback);

AddLabel(yes,
    if newHighPrice then "Price: " + extremeLookback + "-bar High Breakout"
    else if newLowPrice then "Price: " + extremeLookback + "-bar Low Breakdown"
    else if close > mainMA then "Price Above " + maLength + "MA (Uptrend)"
    else "Price Below " + maLength + "MA (Downtrend)",
    if newHighPrice then Color.GREEN else if newLowPrice then Color.RED else if close > mainMA then Color.LIGHT_GREEN else Color.LIGHT_RED);
def fastMA = Average(close, 10);
def slowMA = Average(close, 30);
def trendUp = fastMA > slowMA;
def trendDown = fastMA < slowMA;

AddLabel(yes,
    if trendUp then "TREND: Bullish"
    else if trendDown then "TREND: Bearish"
    else "TREND: Neutral",
    if trendUp then Color.GREEN
    else if trendDown then Color.RED
    else Color.GRAY);

#------------------ Oscillator Regime Labels ------------------
def pctAboveZero = 100 * Average( if osc > 0 then 1 else 0, extremeLookback);
AddLabel(yes,
         "Div %>0 (" + extremeLookback + "): " + AsPercent(pctAboveZero/100),
         if pctAboveZero >= 70 then Color.GREEN
         else if pctAboveZero <= 30 then Color.RED
         else Color.YELLOW);

AddLabel(yes,
         if osc > 0 then "Hedging Pressure UP (Vol Expansion Likely)"
         else "Calmer Regime / Trend Continuation",
         if osc > 0 then Color.GREEN else Color.RED);

#------------------ Trade Signal Labels ------------------
AddLabel(tradeLong, "Trade Signal: LONG", Color.BLUE);
AddLabel(tradeShort, "Trade Signal: SHORT", Color.ORANGE);

AddLabel(yes,
    if osc > 0 and trendUp then "Market Bias: Bullish (Momentum + Trend)"
    else if osc < 0 and trendDown then "Market Bias: Bearish (Momentum + Trend)"
    else if osc > 0 then "Volatility Pressure ↑ (Watch for breakout)"
    else "Neutral/Choppy",
    if osc > 0 and trendUp then Color.GREEN
    else if osc < 0 and trendDown then Color.RED
    else Color.YELLOW);
Thank you for sharing the updated version!.
 
@TexasState @Kitchasap
Here is an enhanced version of the Gamma_Delta_Oscillator with enhance price action trending with labels
Code:
# antwerks enhanced 12/14/2025
declare lower;

#------------------ Inputs ------------------
input priceLength       = 5;    # lookback for price ROC (Delta proxy)
input ivLength          = 5;    # lookback for IV ROC (Gamma proxy)
input smooth            = 3;    # smoothing of divergence
input extremeLookback   = 20;   # window for "extreme" pivots
input showBubbles       = yes;  # value bubbles at extremes
input showArrows        = yes;  # arrows at extremes
input bandMult          = 2.0;  # threshold band multiplier (std dev)
input maLength          = 20;   # moving average for price action label
input tradeSignalMA     = 10;   # MA for trade signal integration

#------------------ Manual ROC Definitions ------------------
def priceROC = if close[priceLength] != 0
               then (close - close[priceLength]) / close[priceLength] * 100
               else 0;

def iv = imp_volatility();
def ivROC = if iv[ivLength] != 0
            then (iv - iv[ivLength]) / iv[ivLength] * 100
            else 0;

#------------------ Divergence ------------------
def rawDiv   = ivROC - priceROC;
def osc      = Average(rawDiv, smooth);

#------------------ Threshold Bands ------------------
def oscMean  = Average(osc, extremeLookback);
def oscStd   = StDev(osc, extremeLookback);
def upperBandVal = oscMean + bandMult * oscStd;
def lowerBandVal = oscMean - bandMult * oscStd;

plot UpperBand = upperBandVal;
UpperBand.SetDefaultColor(Color.LIGHT_GRAY);
UpperBand.SetStyle(Curve.SHORT_DASH);

plot LowerBand = lowerBandVal;
LowerBand.SetDefaultColor(Color.LIGHT_GRAY);
LowerBand.SetStyle(Curve.SHORT_DASH);

#------------------ Plots --------------------
plot ZeroLine = 0;
ZeroLine.SetDefaultColor(Color.GRAY);

plot Oscillator = osc;
Oscillator.AssignValueColor(
    if osc > upperBandVal then Color.CYAN
    else if osc < lowerBandVal then Color.MAGENTA
    else if osc > 0 then Color.GREEN
    else Color.RED);
Oscillator.SetLineWeight(2);

plot Hist = osc;
Hist.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Hist.AssignValueColor(
    if osc > upperBandVal then Color.CYAN
    else if osc < lowerBandVal then Color.MAGENTA
    else if osc > 0 then Color.DARK_GREEN
    else Color.DARK_RED);
Hist.SetLineWeight(3);

#------------------ Extreme Pivots ------------------
def hiN = Highest(osc, extremeLookback);
def loN = Lowest(osc, extremeLookback);

def newHigh = osc == hiN and osc[1] < hiN[1];
def newLow  = osc == loN and osc[1] > loN[1];

plot HighArrow = if showArrows and newHigh then osc else Double.NaN;
HighArrow.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
HighArrow.SetLineWeight(3);
HighArrow.SetDefaultColor(Color.RED);

plot LowArrow = if showArrows and newLow then osc else Double.NaN;
LowArrow.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
LowArrow.SetLineWeight(3);
LowArrow.SetDefaultColor(Color.GREEN);

AddChartBubble(showBubbles and newHigh, osc,
               "New " + extremeLookback + "-bar HIGH\n" + Round(osc, 2),
               Color.RED, yes);

AddChartBubble(showBubbles and newLow, osc,
               "New " + extremeLookback + "-bar LOW\n" + Round(osc, 2),
               Color.GREEN, no);

#------------------ Alerts ------------------
Alert(osc crosses above 0, "Oscillator crossed above zero", Alert.BAR, Sound.Ring);
Alert(osc crosses below 0, "Oscillator crossed below zero", Alert.BAR, Sound.Bell);
Alert(osc crosses above upperBandVal, "Oscillator crossed above upper band", Alert.BAR, Sound.Chimes);
Alert(osc crosses below lowerBandVal, "Oscillator crossed below lower band", Alert.BAR, Sound.Ding);

#------------------ Trade Signal Integration ------------------
def priceMA = Average(close, tradeSignalMA);
def tradeLong = osc crosses above 0 and close > priceMA;
def tradeShort = osc crosses below 0 and close < priceMA;

plot TradeLongSignal = if tradeLong then osc else Double.NaN;
TradeLongSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
TradeLongSignal.SetDefaultColor(Color.BLUE);
TradeLongSignal.SetLineWeight(4);

plot TradeShortSignal = if tradeShort then osc else Double.NaN;
TradeShortSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
TradeShortSignal.SetDefaultColor(Color.ORANGE);
TradeShortSignal.SetLineWeight(4);

#------------------ Price Action Labels ------------------
def mainMA = Average(close, maLength);
def newHighPrice = close == Highest(close, extremeLookback);
def newLowPrice  = close == Lowest(close, extremeLookback);

AddLabel(yes,
    if newHighPrice then "Price: " + extremeLookback + "-bar High Breakout"
    else if newLowPrice then "Price: " + extremeLookback + "-bar Low Breakdown"
    else if close > mainMA then "Price Above " + maLength + "MA (Uptrend)"
    else "Price Below " + maLength + "MA (Downtrend)",
    if newHighPrice then Color.GREEN else if newLowPrice then Color.RED else if close > mainMA then Color.LIGHT_GREEN else Color.LIGHT_RED);
def fastMA = Average(close, 10);
def slowMA = Average(close, 30);
def trendUp = fastMA > slowMA;
def trendDown = fastMA < slowMA;

AddLabel(yes,
    if trendUp then "TREND: Bullish"
    else if trendDown then "TREND: Bearish"
    else "TREND: Neutral",
    if trendUp then Color.GREEN
    else if trendDown then Color.RED
    else Color.GRAY);

#------------------ Oscillator Regime Labels ------------------
def pctAboveZero = 100 * Average( if osc > 0 then 1 else 0, extremeLookback);
AddLabel(yes,
         "Div %>0 (" + extremeLookback + "): " + AsPercent(pctAboveZero/100),
         if pctAboveZero >= 70 then Color.GREEN
         else if pctAboveZero <= 30 then Color.RED
         else Color.YELLOW);

AddLabel(yes,
         if osc > 0 then "Hedging Pressure UP (Vol Expansion Likely)"
         else "Calmer Regime / Trend Continuation",
         if osc > 0 then Color.GREEN else Color.RED);

#------------------ Trade Signal Labels ------------------
AddLabel(tradeLong, "Trade Signal: LONG", Color.BLUE);
AddLabel(tradeShort, "Trade Signal: SHORT", Color.ORANGE);

AddLabel(yes,
    if osc > 0 and trendUp then "Market Bias: Bullish (Momentum + Trend)"
    else if osc < 0 and trendDown then "Market Bias: Bearish (Momentum + Trend)"
    else if osc > 0 then "Volatility Pressure ↑ (Watch for breakout)"
    else "Neutral/Choppy",
    if osc > 0 and trendUp then Color.GREEN
    else if osc < 0 and trendDown then Color.RED
    else Color.YELLOW);
Love the script! Is there a way to make a discription of the arrows but especially the labels and if the colors have meaning? e.g. the oscilator is going up as the P.A. is going down, and a label colored yellow says - Volatlity Pressure (Watch for a breakout) a breakout... which way? Bullish/Bearish? It's yellow so... But thank you so much for your hard work on this.
 
Love the script! Is there a way to make a discription of the arrows but especially the labels and if the colors have meaning? e.g. the oscilator is going up as the P.A. is going down, and a label colored yellow says - Volatlity Pressure (Watch for a breakout) a breakout... which way? Bullish/Bearish? It's yellow so... But thank you so much for your hard work on this.
Sorry I had it written down but cannot find it- I threw it into Chat and this is spot on...
 

Attachments

  • Gamma_Osc.docx
    18.1 KB · Views: 75
@Ronathan Edwards I have been playing with this Gamma_Delta Oscillator and turned it into a scan to find magenta bars in action and now fully understand that the divergences occurring are good signals for reversals or spikes.
Sorry being lazy here of late so the use of TradeGPT here but reviewed it and seems correct and very interesting. Might need a watchlist column lol.
WHAT DOES THE PURPLE BAR REPRESENT IN A SCAN

TradeGPT said:

Great question — and based on your script, the purple (magenta) bar in your oscillator represents a specific market condition tied to implied volatility and price action divergence.

🟣 Purple (Magenta) Bar = Extreme Negative Divergence
🔍 Translation:
  • priceROC: Rate of change in price (momentum)
  • ivROC: Rate of change in implied volatility (options market expectations)
  • osc: Smoothed divergence between those two
The magenta (purple) bar appears when:
osc < lowerBandVal

That means:
The difference between implied volatility and price momentum is significantly negative, beyond a dynamic threshold.
💡 So What Does It Mean?
A purple/magenta bar suggests:

🔎 Signal💬 Interpretation
Implied volatility is dropping fast relative to priceTraders are hedging less, or expecting lower future volatility
Price may still be rising (or flat), but volatility is declining fasterCalm before a reversal or trend exhaustion
The oscillator is statistically below normal range (e.g. 2 SDs below mean)This is a rare/abnormal event, potentially marking inflection points
📈 Trading Implications of Purple Bar

ConditionPossible Read
In uptrend + purple barPrice may stall or reverse, as volatility decays and market gets complacent
In downtrend + purple barCould signal capitulation or exhaustion selloff
Near resistanceWatch for reversal (especially if volume drops too)
Followed by green oscillator recoveryMight be a long setup after panic reset
🧠 Bottom Line:

The purple bar marks an extreme divergence where implied volatility is collapsing relative to price momentum.
It often precedes trend pauses, reversals, or transitions into low-volatility zones.


You said:
WHAT DOES THE CYAN BAR REPRESENT

TradeGPT said:
Excellent follow-up. Just like the purple (magenta) bar, the cyan bar in your oscillator indicates an extreme condition — but in the opposite direction.
🟦 Cyan Bar = Extreme Positive Divergence
🔍 Interpretation:
  • ivROC: Rate of change in implied volatility (how fast it's rising)
  • priceROC: Rate of change in price
  • osc: Measures divergence between them (smoothed)
  • Cyan appears when:
  • osc > upperBandVal
That means:
Implied volatility is increasing faster than price is rising, and this divergence is statistically significant (above 2 standard deviations by default).

📈 What the Cyan Bar Signals
🔎 Signal💬 Interpretation
Options market is getting nervous, hedging aggressively, or bracing for volatility
Price may be rising, but implied volatility is rising even faster
Often seen before breakouts, market stress, or event-driven spikes
Statistically rare: oscillator is above historical norm (upper band = +2 SDs)
⚠️ Context-Dependent Interpretation

Market ConditionCyan Bar Could Mean
🔼 Price trending upPossible breakout build-up or frothy momentum
🔽 Price trending downFear, hedging pressure, or potential crash risk
📉 Flat price, rising IVOptions anticipating big move (earnings, macro risk, etc.)
🧠 Bottom Line:

Cyan bars reflect “high alert” behavior — when implied volatility is surging faster than price.
It's a volatility pressure warning — the market expects something big is coming.


🔍 Use Case:
  • Combine cyan bars with breakout scans
  • Use cyan + RSI + price pattern to detect explosive setups
  • Look for clusters of cyan as a pre-breakout coil signal
Interesting to watch the signals - ofcourse use with other indicators and price action and volume is needed - scan link https://tos.mx/!1tOmMETz
 
Last edited by a moderator:

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
603 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top