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: 847
Click on the Trade tab. Enter or select SPX in the Quote.

On the Option Chain row click Layout, then Customize.

Double-click to open any of the Custom, then change the Column name to what you want.

Click on the thinkScript Editor tab. Click in the area where the existing code is, then select all of the code with Ctrl +A, then press the Delete key. Now paste in the new code.

Click Apply, then OK.
Thanks for the help.
 

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

does this code still works for you?! because its giving me NaN results
Your image is July 18. It was a big down day and your image shows heavy Puts.
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);
15294[/ATTACH]']
Ua5aYVo.jpg
Your image is July 18. July 18 was a big down day. I do not understand your explanation, You Said, " 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" Why do you say it is a contrarian indicator. The image shows heaver in PUT and the day was down. Thanks
 

Attachments

  • Ua5aYVo.jpg
    Ua5aYVo.jpg
    448.8 KB · Views: 182
Your image is July 18. It was a big down day and your image shows heavy Puts.

Your image is July 18. July 18 was a big down day. I do not understand your explanation, You Said, " 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" Why do you say it is a contrarian indicator. The image shows heaver in PUT and the day was down.
Just want to ask why SPY would be opposite to SPX since they move the same way? Not dollar amount but if SPX is trending up so is SPY and vice versa... @FuturesTrader2022
 
i cant get the script to work- when i go to the option Trade tab >layout>customize> drop down menu doesnt show script to choose.. what am i doing wrong?
Double-click to open ANY one of the Custom - Custom 4 for example, then change the Column name to what you want.

Click on the thinkScript Editor tab. Click in the area where the existing code is, then select all of the code with Ctrl +A, then press the Delete key. Now paste in the new code.

Click Apply, then OK.
 
Double-click to open ANY one of the Custom - Custom 4 for example, then change the Column name to what you want.

Click on the thinkScript Editor tab. Click in the area where the existing code is, then select all of the code with Ctrl +A, then press the Delete key. Now paste in the new code.

Click Apply, then OK.
still broken- getting NaN

thanks i used a diff name and it worked
 
Last edited:
SPX GAMMA/OPTIONS. 27 July Options Chain had calls showing yellow and no puts showing yellow. (forgot to screenshot it) Shown on the right of chart are the Open Interest # first and then the Strike. Strike is inside (). The 3950 strike was in the money at open. All the rest OTM at open. The 4000 went ITM at 14:40 est. The 4010 went ATM at 14:40 and soon ITM. The 4030 & 4035 went ITM at 15:25. Daily High was 4039.46 at 15:30. The SPY Options Chain at open was evenly balanced between PUTS & Calls. (took no screenshot) . Today, SPX Call Options worked as a "Market Direction Indicator". NO SPX traders were betting short on the market all day.


o89qqCc.png
 
SPX GAMMA/OPTIONS. 27 July Options Chain had calls showing yellow and no puts showing yellow. (forgot to screenshot it) Shown on the right of chart are the Open Interest # first and then the Strike. Strike is inside (). The 3950 strike was in the money at open. All the rest OTM at open. The 4000 went ITM at 14:40 est. The 4010 went ATM at 14:40 and soon ITM. The 4030 & 4035 went ITM at 15:25. Daily High was 4039.46 at 15:30. The SPY Options Chain at open was evenly balanced between PUTS & Calls. (took no screenshot) . Today, SPX Call Options worked as a "Market Direction Indicator". NO SPX traders were betting short on the market all day.


o89qqCc.png
Have you tried to use it with equities? Is it used to see which side is more skewed towards puts or calls?
 
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);
15300[/ATTACH]']
Ua5aYVo.jpg
I noticed the code doesn't produce the same result as calculating it manually. Why is that? Gamma rounding?

For example, right now the SPX 4025C OI = 1222, gamma = .16, so 1222*.16*100 = 19552, but the code result on the chain is 19,416.08.
 

Attachments

  • Ua5aYVo.jpg
    Ua5aYVo.jpg
    448.8 KB · Views: 125
Have you tried to use it with equities? Is it used to see which side is more skewed towards puts or calls?
Only SPX and SPY. The premise is according to the original post on page 1. Wed the SPX had all Calls, no puts. At about 3 am Thursday EST SPY looks heavier on puts and SPX is shewed to calls. This is all new to me and watching it close. IT may be an edge.
 
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);
15305[/ATTACH]']
Ua5aYVo.jpg
I still don't understand why the maual calculation doesn't agree with the code's calculation.

Add the Gamma and Open Interest columns after the column for the code. The product of those two doesn't equal the code's calculation. What am I missing?
 

Attachments

  • Ua5aYVo.jpg
    Ua5aYVo.jpg
    448.8 KB · Views: 117

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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