Dollar Gamma Calculation

samks_30

New member
2019 Donor
Does anyone here have an idea on how the GEX and DIX are calculated on https://squeezemetrics.com/monitor/dix? I try to multiply gamma by OI at every strike for both calls and puts to get an idea on where the market stands. Any help on calculating daily dollar/gamma exposure would be grateful. Thanks!
 
Last edited:
but don't know what I'm doing. The thinkScript editor accepts the following code; however when I import the code as a custom column in the TOS options chain, I receive an error message stating "invalid symbol name"!

input symbol_1 = “(Gamma())*1/2" ;
input symbol_2 = “Sqr(getUnderlyingSymbol())*1/100” ;
Plot product = close(symbol_1) * (close(symbol_2));
product.SetDefaultColor(GetColor(0));

What I am attempting to code is the formula: 0.5 x Gamma x (Underlying Price x 1%)²

Would someone please help me code this formula?

Thanks in advance...


i think it should be something like this:
input symbol_1 = (Gamma())*1/2 ;
input symbol_2 = Sqr(close(getUnderlyingSymbol())/100) ;
Plot product = symbol_1 * symbol_2;
product.SetDefaultColor(GetColor(0));

if you looking to add to the options chain level just use gamma*OI, don't worry doing using underlying close. i think above concept applies if you are calculating dollar gamma for entire options.
 
Now that we are in RTH, I used the following plot statement in the customized options chain for JPM, expiration 27 DEC 19 (18)
The custom column now shows some good data populating with values ranging from 0.01 to 0.07.
We learn something new every day

Code:
plot myData = gamma()*0.5*Sqr(close(getUnderlyingSymbol())/100);
 
Now that we are in RTH, I used the following plot statement in the customized options chain for JPM, expiration 27 DEC 19 (18)
The custom column now shows some good data populating with values ranging from 0.01 to 0.07.
We learn something new every day

Code:
plot myData = gamma()*0.5*Sqr(close(getUnderlyingSymbol())/100);


Try this:
Code:
plot dollarGamma = (gamma() * close * close(getunderlyingsymbol()) * close(getunderlyingsymbol()) )/100;
 
What I am attempting to code is the formula: 0.5 x Gamma x (Underlying Price x 1%)²

So long as you are getting some data that's all that matters
Noticed that you are not adhering to the formula you initially wanted.
You now have the methodology so you can tweak things to what you were looking for
Best of luck
 
so which gamma is the correct formula? those used do not produce sane results
Code:
plot dollarGamma = (gamma() * close * close(getunderlyingsymbol()) * close(getunderlyingsymbol()) )/100;
plot myData = gamma()*0.5*Sqr(close(getUnderlyingSymbol())/100);
 
Did we ever get a final answer on this? I have tried all the scripts I see in here but unfortunately, they all get stuck on loading. Also, what I believe would really be helpful would be the sum of the positive gamma exposure (calls) and negative gamma exposure (puts) - This is assuming MM is short put long call. Have tried coding this myself but with no success, so thought I'd throw the idea out there! Thanks for any help

Sum for each strike.
 
Did we ever get a final answer on this? I have tried all the scripts I see in here but unfortunately, they all get stuck on loading. Also, what I believe would really be helpful would be the sum of the positive gamma exposure (calls) and negative gamma exposure (puts) - This is assuming MM is short put long call. Have tried coding this myself but with no success, so thought I'd throw the idea out there! Thanks for any help

Sum for each strike.
alot of custom scans were stuck on loading today, TOS had some issues, try loading and let it load for about 10-15 mins and should work if the code is working code and criteria is met.
 
I'm late to the party, but this what NextSignal Doc had on his twitter that I came across while browsing his blog. Not sure why the page is dead now:

7 days agoTo identify the high GEX strike for the strategy, you can simply add a custom column to the options chain. Here's the code I use. If you don't know how to add a custom column in Thinkorswim ... Google is your friend. (I'm not teaching or supporting on this.) No advice. 12:16 PM · Sep 10, 2022·Twitter Web App, Retweets, MattGTheJeweler,

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

plot data = if IsPut() then ceil(gamma() * -100 * open_interest ()) else ceil(gamma() * 100 * open_interest());

I added to my columns and I have nice fat positive and negative numbers (on the put side). I guess this is how you use it:


I also grabbed his Gaming Gamma code - will post if anyone wants it:


Still trying to figure out how to include it in my strategy: Looks that pic in the above tweet the volume studies may be custom? Couldn't find any defaults. Here's what I have with his Adaptive Moving Avg study as well:

aVW0aTu.jpg
 
I'm late to the party, but this what NextSignal Doc had on his twitter that I came across while browsing his blog. Not sure why the page is dead now:

7 days agoTo identify the high GEX strike for the strategy, you can simply add a custom column to the options chain. Here's the code I use. If you don't know how to add a custom column in Thinkorswim ... Google is your friend. (I'm not teaching or supporting on this.) No advice. 12:16 PM · Sep 10, 2022·Twitter Web App, Retweets, MattGTheJeweler,

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

plot data = if IsPut() then ceil(gamma() * -100 * open_interest ()) else ceil(gamma() * 100 * open_interest());

I added to my columns and I have nice fat positive and negative numbers (on the put side). I guess this is how you use it:


I also grabbed his Gaming Gamma code - will post if anyone wants it:


Still trying to figure out how to include it in my strategy: Looks that pic in the above tweet the volume studies may be custom? Couldn't find any defaults. Here's what I have with his Adaptive Moving Avg study as well:

aVW0aTu.jpg
Yes, I'd be interested in the gaming gamma code. Do you have any of his other stuff as well?
 
Yes, I'd be interested in the gaming gamma code. Do you have any of his other stuff as well?

I do, they're on this site. Just search for Nextsignal.

Nextsignal Gamming Gamma code:

Code:
# Buy Signal: Buy when Gamma and price simultaneously decline
# Filters: 1-bar lower OHLC4 and selling pressure (buying into weakness)
# Strike choice: Strike with highest OI (GEX) and near-the-money

def offset = sqrt ((high - low)) * 0.2;
def gamma = gamma();
def gamma1 =  gamma()[1];
def price = close();
def price1 = price[1];
def sellpress = ((high - close) / (high-low)) > 0.6;

plot buyArrow = if price < price1 and gamma < gamma1 and sellpress and OHLC4 < OHLC4[1] then low - offset else 0;
buyArrow.setpaintingstrategy(paintingstrategy.arrow_up);
buyArrow.setdefaultcolor(createcolor(38,115,255));
buyArrow.setlineweight(2);
buyArrow.hidebubble();
buyArrow.hidetitle();

plot buyValue = if price < price1 and gamma < gamma1 and sellpress and OHLC4 < OHLC4[1] then close else double.nan;
buyValue.setpaintingstrategy(paintingstrategy.values_BELOW);
buyValue.setdefaultcolor(color.Yellow);
buyValue.setlineweight(2);
buyValue.hidebubble();
buyValue.hidetitle();
 
I do, they're on this site. Just search for Nextsignal.

Nextsignal Gamming Gamma code:

Code:
# Buy Signal: Buy when Gamma and price simultaneously decline
# Filters: 1-bar lower OHLC4 and selling pressure (buying into weakness)
# Strike choice: Strike with highest OI (GEX) and near-the-money

def offset = sqrt ((high - low)) * 0.2;
def gamma = gamma();
def gamma1 =  gamma()[1];
def price = close();
def price1 = price[1];
def sellpress = ((high - close) / (high-low)) > 0.6;

plot buyArrow = if price < price1 and gamma < gamma1 and sellpress and OHLC4 < OHLC4[1] then low - offset else 0;
buyArrow.setpaintingstrategy(paintingstrategy.arrow_up);
buyArrow.setdefaultcolor(createcolor(38,115,255));
buyArrow.setlineweight(2);
buyArrow.hidebubble();
buyArrow.hidetitle();

plot buyValue = if price < price1 and gamma < gamma1 and sellpress and OHLC4 < OHLC4[1] then close else double.nan;
buyValue.setpaintingstrategy(paintingstrategy.values_BELOW);
buyValue.setdefaultcolor(color.Yellow);
buyValue.setlineweight(2);
buyValue.hidebubble();
buyValue.hidetitle();

I tried this but can't see anything.
 
I'm late to the party, but this what NextSignal Doc had on his twitter that I came across while browsing his blog. Not sure why the page is dead now:

7 days agoTo identify the high GEX strike for the strategy, you can simply add a custom column to the options chain. Here's the code I use. If you don't know how to add a custom column in Thinkorswim ... Google is your friend. (I'm not teaching or supporting on this.) No advice. 12:16 PM · Sep 10, 2022·Twitter Web App, Retweets, MattGTheJeweler,

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

plot data = if IsPut() then ceil(gamma() * -100 * open_interest ()) else ceil(gamma() * 100 * open_interest());

I added to my columns and I have nice fat positive and negative numbers (on the put side). I guess this is how you use it:


I also grabbed his Gaming Gamma code - will post if anyone wants it:


Still trying to figure out how to include it in my strategy: Looks that pic in the above tweet the volume studies may be custom? Couldn't find any defaults. Here's what I have with his Adaptive Moving Avg study as well:

aVW0aTu.jpg
@Iceman1205us
Do you know how to plot (draw) GEX, put premium and call premium in the lower part of charts?
Also, would you please share code of your Adaptive Moving Avg study, as shown in your UVXY220923C11 chart?
 
A lot of stuff on docs website or his tweet is missing or got deleted, I bookmarked some of them recently so that I can study them when I got the free time to do so, and can't find them anymore when going back to those bookmark
 

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

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
272 Online
Create Post

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