OptionsHacker -to show Volume/OpenInterest/GammaExposure for the options chain For ThinkOrSwim

I had a chance to look at your code.

def IV = SeriesVolatility(series = OptionSeries);

This IV is an average or maybe based on atm option volatility. To accurately calculate gamma you would need to calculate the IV for each strike.
 

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

I had a chance to look at your code.

def IV = SeriesVolatility(series = OptionSeries);

This IV is an average or maybe based on atm option volatility. To accurately calculate gamma you would need to calculate the IV for each strike.
Thanks for the heads up, I will look into that!
 
Hi All, I am working on some updates. On the todo wait list are the above mentioned Zero Gamma, possibly calculating IV to get a better gamma representation.

Before I get to those though I wanted to add a 'Series' selection for OPEX dates, which I have managed to do. :D
In addition, I think have found a way to get multiple expiries in there.

For now I'm playing with adding an input 'SeriesDepth' which is a number you set.
For example at Series=Weekly, SeriesDepth=2 it will scan this upcoming friday expiries at the depth setting like normal, and also scan next friday with the same depth.

What other ways or modes would you like to see?

Side question: What are the thoughts on the 'DataType' switch. Should this be changed to just a toggle for each one, that way you can choose to see multiple at once? You could always add the indicator twice as well and change the datatype on the second ...
 
Hi All, I am working on some updates. On the todo wait list are the above mentioned Zero Gamma, possibly calculating IV to get a better gamma representation.

Before I get to those though I wanted to add a 'Series' selection for OPEX dates, which I have managed to do. :D
In addition, I think have found a way to get multiple expiries in there.

For now I'm playing with adding an input 'SeriesDepth' which is a number you set.
For example at Series=Weekly, SeriesDepth=2 it will scan this upcoming friday expiries at the depth setting like normal, and also scan next friday with the same depth.

What other ways or modes would you like to see?

Side question: What are the thoughts on the 'DataType' switch. Should this be changed to just a toggle for each one, that way you can choose to see multiple at once? You could always add the indicator twice as well and change the datatype on the second ...
I’m really curious to try out the series depth and data type should stay as us because, it might be take too much processing power otherwise
 
I’m really curious to try out the series depth and data type should stay as us because, it might be take too much processing power otherwise
I'm curious how that works, as I understand it, the thinkscript is stored and run on TOS servers correct? So in the script we are processing the data for every mode regardless, the DataType switch just sets the hiding for the plots.

Even if I added a check for the datatype on the fold like:
def TotalPutVolume = if DataType == DataType.Volume #THIS CHECK HERE <--------------------
fold pvIndex = -(StrikeDepth) to (StrikeDepth + 1)
with pv = 0
do
if !IsNaN(
volume(("." + GetSymbolPart()) + AsPrice(OptionExpiryDate - 20000001) + "P" + AsPrice(CenterStrike + StrikeSpacing * pvIndex))
)
then pv + volume(("." + GetSymbolPart()) + AsPrice(OptionExpiryDate - 20000001) + "P" + AsPrice(CenterStrike + StrikeSpacing * pvIndex))
else pv + 0
else 0; # ELSE ZERO HERE <---------------
Would that possibly improve performance? Even though its still setting a value to zero technically. The downside to this approach if I'm understanding correctly, is that you would have reload every time you wanted to change the DataType.

Might be better to just separate these out into three separate indicators ... will continue researching ...
 
I'm curious how that works, as I understand it, the thinkscript is stored and run on TOS servers correct? So in the script we are processing the data for every mode regardless, the DataType switch just sets the hiding for the plots.

Even if I added a check for the datatype on the fold like:

Would that possibly improve performance? Even though its still setting a value to zero technically. The downside to this approach if I'm understanding correctly, is that you would have reload every time you wanted to change the DataType.

Might be better to just separate these out into three separate indicators ... will continue researching ...
Yeah probably best to separate for faster performance
 
Hi All,

I've updated the first post with a new version, now including an Opex datatype 🥳
Also I've simplified the data gathering code as well, utilizing 'script'.

I did mess a bit with adding more than one expiry date, but this will need further testing.

One thing that needs to be looked into as said above by bobmarley, the implied volatility I believe is not correct.
If anyone can help to shed some light on the different functions that would be great, so far the only 'built-in' way that seems to yield any meaningful data, is the SeriesVolatility() function I am using now. Ideally we should be calculating IV at each spot.
 
TB3tPVn.png

PJCNCPW.png

Here's my current setup, you can see how increased put buying + diminishing call buying is affecting the gamma environment.
 
Last edited:
Hola friend. Nice update. Thank you.

Ideas for you:

Call GEX = gamma * OI * 100 * Spot Price

Spot Price refers to the price of the underlying.

Also if it helps to reduce processing power you can use this:

GEX = (TotalCallGammaExposure - TotalPutGammaExposure) * 100 * Spot Price
 
Hola friend. Nice update. Thank you.

Ideas for you:

Call GEX = gamma * OI * 100 * Spot Price

Spot Price refers to the price of the underlying.

Also if it helps to reduce processing power you can use this:

GEX = (TotalCallGammaExposure - TotalPutGammaExposure) * 100 * Spot Price
Thanks, I do have those calculations in place already! Check out the input for 'gex calculation method'

I want to use that to get zero gamma, as pointed out by conmayne above, but I'm having a hard time following what exactly I need to do. Doesn't make it easier that it is incredibly difficult to work inside the 'fold' within thinkscipt. (i.e cannot set variables, def etc. etc.)
 
Thanks, I do have those calculations in place already! Check out the input for 'gex calculation method'

I want to use that to get zero gamma, as pointed out by conmayne above, but I'm having a hard time following what exactly I need to do. Doesn't make it easier that it is incredibly difficult to work inside the 'fold' within thinkscipt. (i.e cannot set variables, def etc. etc.)
Hey nice updates - I'm not able to get V.3 to show on lower.
 
"
if GEXMethod == 1 then
OptionPrice((CenterStrike + (StrikeSpacing * index)), !IsCall, DTE, close, IV, no, 0.0, r)"

It looks like you are multiplying the OI times the option price. But you should be multiplying OI times the spot price of the stock.
 
"
if GEXMethod == 1 then
OptionPrice((CenterStrike + (StrikeSpacing * index)), !IsCall, DTE, close, IV, no, 0.0, r)"

It looks like you are multiplying the OI times the option price. But you should be multiplying OI times the spot price of the stock.
Ahh, I'll look into that as I wasn't quite sure. For that I am following this: https://perfiliev.co.uk/market-commentary/how-to-calculate-gamma-exposure-and-zero-gamma-level/

I assumed it was spot price of the option ...
 
Why when I have the script active my candle sticks stop moving across all my charts (I only have the script on one chart)
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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