Reading Options Data In ThinkOrSwim

taipanaz

New member
hi, i want to add options open interest volume to my charts. i would like to be able to put the date of the options, total call volume, total put volume, call 1 (input highest open interest-thick green line), call 2 (input mid open interest-mid green thikness), call 3 (input low open interest-just a green line) and same with puts, but red line. this way i can see see where options thinks the support and resistance is. is it possible?

having issues with inputs (4 calls and 4 puts) also how to get script to select the options from my date input. would like it to thinken the line depending on the open interest volume for strike price i selected. also i want to remove the getsymbol and use the currect stock you have selected in the chart. here is what i got so far:

Ruby:
#input DateOfOption = date;
#input call1 = call1;
#input call2 = call2;
#input call3 = call3;
#input call3 = call4;
#input put1 = put1;
#input put2 = put2;
#input put3 = put3;
#input put3 = put4;

plot oi_call_1;
plot oi_call_2;
plot oi_call_3;
plot oi_call_4;
plot oi_put_1;
plot oi_put_2;
plot oi_put_3;
plot oi_put_4;

if (GetSymbol() == "TSLA")
{
oi_call_1 = call1;
oi_call_2 = call2;
oi_call_3 = call3;
oi_call_4 = call4;
oi_put_1 = put1;
oi_put_2 = put2;
oi_put_3 = put3;
oi_put_4 = put4;
} else
{
oi_call_1 = Double.NaN;
oi_call_2 = Double.NaN;
oi_call_3 = Double.NaN;
oi_call_4 = Double.NaN;
oi_put_1 = Double.NaN;
oi_put_2 = Double.NaN;
oi_put_3 = Double.NaN;
oi_put_4 = Double.NaN;
}
;
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, 158, 29));
oi_call_1.SetLineWeight(5);
oi_call_2.SetLineWeight(4);
oi_call_3.SetLineWeight(3);
oi_call_4.SetLineWeight(2);
oi_put_1.SetDefaultColor(CreateColor(255, 17, 17));
oi_put_2.SetDefaultColor(CreateColor(255, 56, 56));
oi_put_3.SetDefaultColor(CreateColor(255, 56, 46));
oi_put_4.SetDefaultColor(CreateColor(213, 0, 0));
oi_put_1.SetLineWeight(5);
oi_put_2.SetLineWeight(4);
oi_put_3.SetLineWeight(3);
oi_put_4.SetLineWeight(2);
 
Last edited by a moderator:
having issues with inputs (symbol, date, 3 calls and 3 puts) also how to get script to select the options from my date input. here is what i got so far:
#input
input Symbol = sym
input DateOfOption = date;
input call1 = call1;
input call2 = call2;
input call3 = call3;
input put1 = put1;
input put2 = put2;
input put3 = put3;

plot oi_call_1;
plot oi_call_2;
plot oi_call_3;
plot oi_put_1;
plot oi_put_2;
plot oi_put_3;

if (GetSymbol() == sym)
{
oi_call_1 = call1;
oi_call_2 = call2;
oi_call_3 = call3;
oi_put_1 = put1;
oi_put_2 = put2;
oi_put_3 = put3;
} else
{
oi_call_1 = Double.NaN;
oi_call_2 = Double.NaN;
oi_call_3 = Double.NaN;
oi_put_1 = Double.NaN;
oi_put_2 = Double.NaN;
oi_put_3 = Double.NaN;
};
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_1.SetLineWeight(5);
oi_call_2.SetLineWeight(4);
oi_call_3.SetLineWeight(3);
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_1.SetLineWeight(5);
oi_put_2.SetLineWeight(4);
oi_put_3.SetLineWeight(3);

reading options data is complicated and usually requires many nested functions, to build valid option codes.

your formulas are too simple and will not work for reading options data.

take a look at this. this is an extreme example, that calcs oi for 40 strikes.
https://usethinkscript.com/threads/option-heatmap-and-oi-strikes.10664/page-4#post-94445
post67

one of the formulas
def c1_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike - strikeSpacing *0 ))));


post 68 has a screen shot

===============
EDIT 3/2
some posts have been changed around in the thread.
post #1 now has the current version.
https://usethinkscript.com/threads/option-heatmap-and-oi-strikes.10664/

===============
 
Last edited:
thank you, will take a look and see what i can add to my script. i think i will just have the script put lines from my strike price i selected with the highest open interest. maybe should start there and then make it more complicated
 
thank you, will take a look and see what i can add to my script. i think i will just have the script put lines from my strike price i selected with the highest open interest. maybe should start there and then make it more complicated
Hi Taipanaz,

Hope you are using the OI script. Let us know if you have final script.

thanks
 
Last edited:

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