Visual Positive/Negative/Zero Gamma Regime For ThinkOrSwim

dynamic gamma regime indicator on upper study showing when gamma is positive, negative or zero similar to spotgamma.com gamma levels

any good coders want to take a crack at it? I have no idea how to draw or infer gamma from options aside from using ATR as a volatility measurement.

positive gamma = mms and whales pin price
negative gamma = mms and whales add to momentum to hedge short options strikes losing value due to an expansion of volatility

pseudocode:

historic zero gamma line
current zero gamma
gamma now
gamma accelerating or decelerating
a line/average projected forward five bars from last price showing gamma-derived price momentum up down or flat

label ideas: "hedge: anti-vol pinning ( gamma is positive, pinning, mean reverting), pro-vol fueling (gamma is negative, adding to momentum, trending)"

something along those lines
 
here's my shot at inferring positive gamma squeezing from stdev of slope of atr.
could add volume effort relative to atr expansion (difficulty of movement)
along with imp volatility/iv rank
@ziongotoptions
@halcyonguy
@Angrybear

anyone up to calculating actual option gamma?

Code:
#Gamma Regime

#stdev of atr slope used to infer positive gamma pinning pressure application and release


declare lower;

#add by cwen
declare once_per_bar;
### ATR + Visual

input length = 3;
plot zeroline = 0;
zeroline.setdefaultColor(color.yellow);


#when is the average price less than the atr
def a = if close > ohlc4 and close[1] < close then atr(length)
        else if close < ohlc4 and close[1] > close then -atr(length) else 0;
def b = expaverage(a);
def c = a / b;
def d = stdev(c);

#slope -- not mine
input HowManyPeriodsBackForSlopeMeasure= 7;
def SMALength = length;
input agg = aggregationPeriod.Day;
input ShowTroubleshootLabels= no;
def SMA = hullMovingAvg( b , smalength);
def opposite = (SMA - SMA[HowManyPeriodsBackForSlopeMeasure])/SMA[HowManyPeriodsBackForSlopeMeasure];
def adjacent = HowManyPeriodsBackForSlopeMeasure * .5;
def tan = opposite / adjacent;
def e = (ROUND(atan(tan)* 180 / Double.Pi,2));

def f = if close[1] < close then expaverage(e) else if close[1] > close then -hullMovingAvg(e) else 0;

def f1 = -hullMovingAvg(f);
def f2 = f1;

def g = hullMovingAvg(stdev(f));
plot h = 0 + g;
h.setdefaultcolor(color.gray);
addcloud(0,h, color.white, color.white, no);
def h2 = 0 + 2*g;
addcloud(h,h2, getcolor(3) , getcolor(3), no);
def h3 = 0 + 3*g;
addcloud(h2,h3, color.gray, color.gray, no);
plot i = 0 - g;
i.setdefaultcolor(color.gray);
addcloud(0,i, color.white, color.white, no);
def i2 = 0 - 2*g;
addcloud(i,i2, getcolor(3) , getcolor(3), no);
def i3 = 0 - 3*g;
addcloud(i2,i3, color.gray, color.gray, no);

plot j = expaverage(lowest(h, length * 4));
j.setdefaultcolor(color.gray);
plot j2 = -j;
j2.setdefaultcolor(color.gray);
plot j3 = expaverage(lowest(h2, length * 4));
j3.setdefaultcolor(color.white);
plot j4 = -j3;
j4.setdefaultcolor(color.white);


plot k = if h3 < j
        and h2 < j
        and h < j
then zeroline else double.nan; #heavy pinning
k.setpaintingstrategy(paintingstrategy.squares);
k.setdefaultcolor(color.red);
k.setlineweight(5);

plot k2 = if h2 < j #medium pinning
          and h < j then zeroline else double.nan;
k2.setpaintingstrategy(paintingstrategy.squares);
k2.setdefaultcolor(color.yellow);
k2.setlineweight(5);

plot k3 = if h < j then zeroline else double.nan; #light pinning
k3.setpaintingstrategy(paintingstrategy.squares);
k3.setdefaultcolor(color.cyan);
k3.setlineweight(3);

plot k4 = if h > j then zeroline else double.nan;
k4.setpaintingstrategy(paintingstrategy.squares);
k4.setdefaultcolor(createcolor(10,10,200));
k4.setlineweight(1);

#plot gammalite = if atr < avg then sd_atr else double.nan;
#gammalite.setpaintingstrategy(paintingstrategy.squares);
#gammalite.setdefaultcolor(color.red);
#gammalite.setlineweight(1);
 
here's my shot at inferring positive gamma squeezing from stdev of slope of atr.
could add volume effort relative to atr expansion (difficulty of movement)
along with imp volatility/iv rank


anyone up to calculating actual option gamma?
This has been done. Mobius Greeks, as an approximation really, but useful in calculating gamma.
You should only be concerned with direction and size of the move (think pinning against a wall, back away, creating room, then launching in that direction after the call wall comes down due to expiry (ie. SPY wed expiry), Thursday launches higher.

I don't think ATR is useful outside of CCI filtering, (ie. you can see a squeeze), and you're not tracking Gamma from Overbought/Oversold vice versa. You want to see see where DELTA NEUTRAL dynamic scalp/hedging is happening, ie at Gamma Flip points and at hedge levels in between.
You're not far off on the stdev of the slope, just don't use ATR.
Also you might consider the volume weight for the expansion (like after a squeeze). But only if you can measure backwards say 5,10,15,21 trading days etc. and locate past gamma hedging/scalping areas.

More info at SpotGamma on the pinning levels.
 
Last edited:
This has been done. Mobius Greeks, as an approximation really, but useful in calculating gamma.
You should only be concerned with direction and size of the move (think pinning against a wall, back away, creating room, then launching in that direction after the call wall comes down due to expiry (ie. SPY wed expiry), Thursday launches higher.

I don't think ATR is useful outside of CCI filtering, (ie. you can see a squeeze), and you're not tracking Gamma from Overbought/Oversold vice versa. You want to see see where DELTA NEUTRAL dynamic scalp/hedging is happening, ie at Gamma Flip points and at hedge levels in between.
You're not far off on the stdev of the slope, just don't use ATR.
Also you might consider the volume weight for the expansion (like after a squeeze). But only if you can measure backwards say 5,10,15,21 trading days etc. and locate past gamma hedging/scalping areas.

More info at SpotGamma on the pinning levels.
I've recently been studying VSA (volume spread analysis) which I think is important in the gamma squeezes. just fyi
 

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
490 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