Option Heatmap and OI Strikes For ThinkOrSwim

I am not a thinkscript coder so am not able to help but it may give ideas to those that can. Anyway thanks to all for posting the code for the OI script been looking for it for long
 
Hi is it possible to have labels to the OI, maybe the highest 5 calls and puts or draw the lines on the main chart? Like this
203228d1456437737.png
my apologies, i had remove the part of the script script for the chart bubbles, I just added it back. https://usethinkscript.com/threads/option-heatmap-and-oi-strikes.10664/post-94445 see if it works now
 
That looks great. Noticed bars do not show up on SPX (price bubble do) though show up on SPY and other tickers. Wonder why?

Can one add a user defined filter to only plot price bubbles above a manually defined number. This way have less clutter or maybe just the top 5 biggest OI are marked with price bubbles. If not its still is great. Thanks
 
Also I found that this script for labeling open interest which is given free every day by https://www.quanttradingapp.com/discord_pub/thinkscript_open_interest. Don't know if this helps


Code:
#
# Plot Hightest OI Levels on Chart
# Only Valid For: Friday, April 08, 2022
#
# Script Generated: 2022-04-08 08:00:12 AM
# Free Tickers Included: AAPL,AMZN,DIA,DIS,FB,GLD,GOOGL,IWM,NFLX,QQQ,SPY,TSLA,NVDA,AMD
# Total Tickers: 14
#
# Credit: Quant Trading App (c) 2021-2022
# Discord: https://quanttradingdiscord.com
#

def aggregationPeriod = AggregationPeriod.DAY;def LastPrice = close(priceType = PriceType.LAST);def total_call_premium;def total_put_premium;
plot oi_call_1;plot oi_call_2;plot oi_call_3;plot oi_call_4;plot oi_call_5;plot oi_put_1;plot oi_put_2;plot oi_put_3;plot oi_put_4;plot oi_put_5;
if (GetSymbol() == "AAPL") {total_call_premium = 382730.57;total_put_premium = 237766.65;oi_call_1 = 180;oi_call_2 = 175;oi_call_3 = 170;oi_call_4 = 177.5;oi_call_5 = 185;oi_put_1 = 170;oi_put_2 = 160;oi_put_3 = 175;oi_put_4 = 167.5;oi_put_5 = 165;}else if (GetSymbol() == "AMZN") {total_call_premium = 829120.56;total_put_premium = 3294755.32;oi_call_1 = 3300;oi_call_2 = 3400;oi_call_3 = 3500;oi_call_4 = 3200;oi_call_5 = 3600;oi_put_1 = 3000;oi_put_2 = 3100;oi_put_3 = 3015;oi_put_4 = 2950;oi_put_5 = 3490;}else if (GetSymbol() == "DIA") {total_call_premium = 38061.73;total_put_premium = 23450.76;oi_call_1 = 344;oi_call_2 = 354;oi_call_3 = 356;oi_call_4 = 349;oi_call_5 = 348;oi_put_1 = 329;oi_put_2 = 348;oi_put_3 = 315;oi_put_4 = 341;oi_put_5 = 342;}else if (GetSymbol() == "DIS") {total_call_premium = 4571.37;total_put_premium = 46655.94;oi_call_1 = 145;oi_call_2 = 144;oi_call_3 = 140;oi_call_4 = 133;oi_call_5 = 142;oi_put_1 = 128;oi_put_2 = 130;oi_put_3 = 134;oi_put_4 = 127;oi_put_5 = 129;}else if (GetSymbol() == "FB") {total_call_premium = 692845.36;total_put_premium = 102656.41;oi_call_1 = 200;oi_call_2 = 240;oi_call_3 = 250;oi_call_4 = 222.5;oi_call_5 = 230;oi_put_1 = 200;oi_put_2 = 190;oi_put_3 = 215;oi_put_4 = 220;oi_put_5 = 225;}else if (GetSymbol() == "GLD") {total_call_premium = 28848.77;total_put_premium = 24817.19;oi_call_1 = 198;oi_call_2 = 181;oi_call_3 = 185;oi_call_4 = 190;oi_call_5 = 180;oi_put_1 = 176;oi_put_2 = 179;oi_put_3 = 177;oi_put_4 = 180;oi_put_5 = 175;}else if (GetSymbol() == "GOOGL") {total_call_premium = 146315.7;total_put_premium = 310393.9;oi_call_1 = 2800;oi_call_2 = 2900;oi_call_3 = 3000;oi_call_4 = 2850;oi_call_5 = 2930;oi_put_1 = 2700;oi_put_2 = 2600;oi_put_3 = 2750;oi_put_4 = 2650;oi_put_5 = 2800;}else if (GetSymbol() == "IWM") {total_call_premium = 41415.24;total_put_premium = 293727.4;oi_call_1 = 211;oi_call_2 = 210;oi_call_3 = 201;oi_call_4 = 204;oi_call_5 = 207;oi_put_1 = 190;oi_put_2 = 204;oi_put_3 = 195;oi_put_4 = 194;oi_put_5 = 198;}else if (GetSymbol() == "NFLX") {total_call_premium = 55214.35;total_put_premium = 107048.6;oi_call_1 = 390;oi_call_2 = 425;oi_call_3 = 400;oi_call_4 = 410;oi_call_5 = 420;oi_put_1 = 360;oi_put_2 = 355;oi_put_3 = 350;oi_put_4 = 340;oi_put_5 = 365;}else if (GetSymbol() == "QQQ") {total_call_premium = 397452.26;total_put_premium = 1020109.49;oi_call_1 = 358;oi_call_2 = 355;oi_call_3 = 375;oi_call_4 = 370;oi_call_5 = 365;oi_put_1 = 350;oi_put_2 = 355;oi_put_3 = 345;oi_put_4 = 360;oi_put_5 = 340;}else if (GetSymbol() == "SPY") {total_call_premium = 935513.52;total_put_premium = 640624.12;oi_call_1 = 460;oi_call_2 = 450;oi_call_3 = 455;oi_call_4 = 465;oi_call_5 = 457;oi_put_1 = 440;oi_put_2 = 445;oi_put_3 = 425;oi_put_4 = 442;oi_put_5 = 435;}else if (GetSymbol() == "TSLA") {total_call_premium = 4085952.2;total_put_premium = 2404942.68;oi_call_1 = 1200;oi_call_2 = 1150;oi_call_3 = 1100;oi_call_4 = 1250;oi_call_5 = 1300;oi_put_1 = 1000;oi_put_2 = 950;oi_put_3 = 900;oi_put_4 = 1100;oi_put_5 = 1020;}else if (GetSymbol() == "NVDA") {total_call_premium = 156427.48;total_put_premium = 947041.4;oi_call_1 = 300;oi_call_2 = 240;oi_call_3 = 250;oi_call_4 = 275;oi_call_5 = 260;oi_put_1 = 240;oi_put_2 = 230;oi_put_3 = 250;oi_put_4 = 260;oi_put_5 = 255;}else if (GetSymbol() == "AMD") {total_call_premium = 44227.37;total_put_premium = 348995.29;oi_call_1 = 110;oi_call_2 = 115;oi_call_3 = 120;oi_call_4 = 125;oi_call_5 = 112;oi_put_1 = 110;oi_put_2 = 100;oi_put_3 = 85;oi_put_4 = 95;oi_put_5 = 90;}else {oi_call_1 = Double.NaN;oi_call_2 = Double.NaN;oi_call_3 = Double.NaN;oi_call_4 = Double.NaN;oi_call_5 = Double.NaN;oi_put_1 = Double.NaN;oi_put_2 = Double.NaN;oi_put_3 = Double.NaN;oi_put_4 = Double.NaN;oi_put_5 = Double.NaN;total_call_premium = 0;total_put_premium = 0;};oi_call_1.SetDefaultColor(CreateColor(0,236,59));oi_call_2.SetDefaultColor(CreateColor(0,197,49));oi_call_3.SetDefaultColor(CreateColor(0,158,39));oi_call_4.SetDefaultColor(CreateColor(0,119,29));oi_call_5.SetDefaultColor(CreateColor(0,79,20));oi_call_1.SetLineWeight(5);oi_call_2.SetLineWeight(4);oi_call_3.SetLineWeight(3);oi_call_4.SetLineWeight(2);oi_call_5.SetLineWeight(1);oi_put_1.SetDefaultColor(CreateColor(255,17,17));oi_put_2.SetDefaultColor(CreateColor(255,56,56));oi_put_3.SetDefaultColor(CreateColor(213,0,0));oi_put_4.SetDefaultColor(CreateColor(173,0,0));oi_put_5.SetDefaultColor(CreateColor(134,0,0));oi_put_1.SetLineWeight(5);oi_put_2.SetLineWeight(4);oi_put_3.SetLineWeight(3);oi_put_4.SetLineWeight(2);oi_put_5.SetLineWeight(1);addLabel (total_call_premium, "Calls: $"+ total_call_premium +" | Puts: $"+ total_put_premium, color.LIGHT_GRAY);

just to clarify, the code in post 80 does not read any data. all it is , is constants, that are plotted. someone has to manually edit the code and add the data for the day, every day.
 
That looks great. Noticed bars do not show up on SPX (price bubble do) though show up on SPY and other tickers. Wonder why?

Can one add a user defined filter to only plot price bubbles above a manually defined number. This way have less clutter or maybe just the top 5 biggest OI are marked with price bubbles. If not its still is great. Thanks
Yeah it’s not possible to show on SPX, something about the chart doesn’t allow it to work, you’d have to manually enter the symbol in the code and display it on a chart like spy or ES, but it wouldn’t work as a profile in that case, so it’s impossible. I think I posted a script in option volume /open interest that will give the data and add labels for SPX options on the weekly , basically similar info but not in the form of a profile. As for your question, I’m sure it’s possible but you’d have to look into that
 
Does this only work during live market hours? I tried to load it on my charts this past weekend and it didn't work. I didn't have time this wk yet but was wondering so I could work on it this weekend...
It works , it’s that for Expdom instead of 13 replace with 14 or you can just adjust the date by going into settings and inputting 1 for date fix, last month expiration ended on a Thursday so that’s why we used 13 normally it’s 14
 
It works , it’s that for Expdom instead of 13 replace with 14 or you can just adjust the date by going into settings and inputting 1 for date fix, last month expiration ended on a Thursday so that’s why we used 13 normally it’s 14
Thanks, I ended up figuring that out. Could this be created for GEX levels? I got a script in the option chain that I export to excel and it displays each strike with the amount of gamma exposure. I do draw the gamma levels on my charts but it doesn't work well as the gamma amounts change as price moves.
 
Thanks, I ended up figuring that out. Could this be created for GEX levels? I got a script in the option chain that I export to excel and it displays each strike with the amount of gamma exposure. I do draw the gamma levels on my charts but it doesn't work well as the gamma amounts change as price moves.
That’s not possible on thinkorswim unfortunately, you can’t pull data directly from the option chain for think script
 
I am not too sure if I am importing the script wrong but can someone post a ToS link with the working script? I've imported a few and nothing is showing up on my charts. Thank you.
 
I am not too sure if I am importing the script wrong but can someone post a ToS link with the working script? I've imported a few and nothing is showing up on my charts. Thank you.
Go to settings, input 1 for date fix, that should clear up the problem
 
I am not too sure if I am importing the script wrong but can someone post a ToS link with the working script? I've imported a few and nothing is showing up on my charts. Thank you.
I also updated the script just now, it will now work without having to use the date fix input
 

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
264 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