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: 1,746
How is this code any different than the other? They look exactly the same? I just downloaded it, it didn't show up in my "Available Items" because all my customized ones are used. I deleted one and renamed it, copied and pasted the script and I have the same problem... help, please?
I didn't look at the other. The one I just posted works.
 

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

lP15xUi.png


I literally just walked my friend through the process and he got it working coming from a "virgin" custom available item, and it worked fine for him. I DON'T have any unused items, I have deleted and renamed and put in your code on a script that was already set for "D" day ... and it still doesn't work.

Don't ask me why, or how, but with my friend, he said try it one more time with another customized item and it worked ... go figure.... THANKS !!
Since I'm on here, how am I to read negative numbers on the put side? Does than mean "sells"? So, example, if there are more yellows on the put side OTM than the calls, BUT they are negative numbers, what does that mean?
 
lP15xUi.png


I literally just walked my friend through the process and he got it working coming from a "virgin" custom available item, and it worked fine for him. I DON'T have any unused items, I have deleted and renamed and put in your code on a script that was already set for "D" day ... and it still doesn't work.

Don't ask me why, or how, but with my friend, he said try it one more time with another customized item and it worked ... go figure.... THANKS !!
Since I'm on here, how am I to read negative numbers on the put side? Does than mean "sells"? So, example, if there are more yellows on the put side OTM than the calls, BUT they are negative numbers, what does that mean?
https://usethinkscript.com/threads/...that-trades-options-please.11911/#post-103369
 
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);
16853[/ATTACH]']
Ua5aYVo.jpg
Hey, I like this alot. I saw that you wanted to see different colors for varying values and I tweaked it some so that you can see absolute values of 10k, 20k, 50k, 100k, 200k, 500k and 1,000,000 in gamma exposure. its been helpful in recent days in finding price targets for scalps actually and being able to see what contracts MMs are gonna gravitate towards and pull away from @ EOD. I've never posted in here but I hope this is helpful to you and thank you for this gem as I've been interested in gamma and gamma exposure for a while now.



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

def rangeHigh = Highestall (absvalue(data)) ;


assignbackgroundcolor (if absvalue(data) > 1000000 then color.white else if AbsValue(data) > 500000 then color.gray else if absvalue(data) > 200000 then color.green else if absvalue(data) > 100000 then color.yellow else if AbsValue(data) > 50000 then color.light_orange else if AbsValue(data) > 20000 then color.cyan else if AbsValue(data) > 9999 then createcolor(250,150,100) else color.black);




data.assignvaluecolor(if absvalue (data) > 200000 then color.blue else if absvalue (data) > 100000 then color.light_red else if AbsValue(data) > 9999 then color.black else color.current);






QQQ
12.22
JlwqFmn.png


QQQ
12.23
ANqptSE.png
 

Attachments

  • Ua5aYVo.jpg
    Ua5aYVo.jpg
    448.8 KB · Views: 325
Last edited:
Hey, I like this alot. I saw that you wanted to see different colors for varying values and I tweaked it some so that you can see absolute values of 10k, 20k, 50k, 100k, 200k, 500k and 1,000,000 in gamma exposure. its been helpful in recent days in finding price targets for scalps actually and being able to see what contracts MMs are gonna gravitate towards and pull away from @ EOD. I've never posted in here but I hope this is helpful to you and thank you for this gem as I've been interested in gamma and gamma exposure for a while now.



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

def rangeHigh = Highestall (absvalue(data)) ;


assignbackgroundcolor (if absvalue(data) > 1000000 then color.white else if AbsValue(data) > 500000 then color.gray else if absvalue(data) > 200000 then color.green else if absvalue(data) > 100000 then color.yellow else if AbsValue(data) > 50000 then color.light_orange else if AbsValue(data) > 20000 then color.cyan else if AbsValue(data) > 9999 then createcolor(250,150,100) else color.black);




data.assignvaluecolor(if absvalue (data) > 200000 then color.blue else if absvalue (data) > 100000 then color.light_red else if AbsValue(data) > 9999 then color.black else color.current);






QQQ
12.22
JlwqFmn.png


QQQ
12.23
ANqptSE.png
@turfnerd6300 thanks for sharing. I will load it up and test.
 
how'd it fare? btw do you know how to set up a scan for this?
What I have found is that the levels matter but you have no idea if they are long or short trades. Tradytics seems to offer me the best way to judge if they are long or shorts. Market net flow is the best indicator by far. You can have SPX bearish and the SPY bearish but if the total market net flow is positive delta then the index goes up regardless. The dealers are hedged either way. Total market deltas seem to be the biggest factor. Then I can use the gamma study to identify the largest levels.
 
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);
17318[/ATTACH]']
Ua5aYVo.jpg
Gamma was heavy on SPY today and SPY moved up. Now I'm curious to see what it will be like when SPY trades sideways.
 

Attachments

  • Ua5aYVo.jpg
    Ua5aYVo.jpg
    448.8 KB · Views: 275
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);
17326[/ATTACH]']
Ua5aYVo.jpg
Do you close and open the options chain again to refresh the gamma?
 

Attachments

  • Ua5aYVo.jpg
    Ua5aYVo.jpg
    448.8 KB · Views: 219
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
Ok so Opening Range is either plotted automatically or you are drawing these in by hand?
 
Hey, I like this alot. I saw that you wanted to see different colors for varying values and I tweaked it some so that you can see absolute values of 10k, 20k, 50k, 100k, 200k, 500k and 1,000,000 in gamma exposure. its been helpful in recent days in finding price targets for scalps actually and being able to see what contracts MMs are gonna gravitate towards and pull away from @ EOD. I've never posted in here but I hope this is helpful to you and thank you for this gem as I've been interested in gamma and gamma exposure for a while now.



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

def rangeHigh = Highestall (absvalue(data)) ;


assignbackgroundcolor (if absvalue(data) > 1000000 then color.white else if AbsValue(data) > 500000 then color.gray else if absvalue(data) > 200000 then color.green else if absvalue(data) > 100000 then color.yellow else if AbsValue(data) > 50000 then color.light_orange else if AbsValue(data) > 20000 then color.cyan else if AbsValue(data) > 9999 then createcolor(250,150,100) else color.black);




data.assignvaluecolor(if absvalue (data) > 200000 then color.blue else if absvalue (data) > 100000 then color.light_red else if AbsValue(data) > 9999 then color.black else color.current);






QQQ
12.22
JlwqFmn.png


QQQ
12.23
ANqptSE.png
Can Anybody convert this to a lower "study" chart?
 
Can Anybody convert this to a lower "study" chart?

'this' what? you didn't post any code.

please go find the post you are talking about,
click on the post# at the top right,
the web page will reload, with a link that goes to that post.
copy the web address and paste in a post.

post 64 is only partial code.
please also find and link the primary post with the original code.
 
Last edited:
This can be a Watchlist Column also.

plot data = if IsPut() then gamma() * -100 * open_interest() else gamma() * 100 * open_interest();
assignbackgroundcolor(if AbsValue(data) > 2000 then color.orange else color.black);
data.assignvaluecolor(if AbsValue(data) > 2000 then color.black else color.current)

WgOQ9I7.png
 
This script gives ne NaN on every strike

It works on my Options chain.

This can be a Watchlist Column also.

plot data = if IsPut() then gamma() * -100 * open_interest() else gamma() * 100 * open_interest();
assignbackgroundcolor(if AbsValue(data) > 2000 then color.orange else color.black);
data.assignvaluecolor(if AbsValue(data) > 2000 then color.black else color.current)

WgOQ9I7.png

Is this different from the original post?
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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