Get OI and IV from Option Contract

Flexo

New member
I modifed a script I found on this forum and I am trying to get IV and OI of a Option.

I can see in ToS that the IV changes with every Strike whereas I can only get it to give me the IV from GetUnderlyingSymbol(), which remains the same no matter the strike
.
I'm also only able to see N/A for Open Interest most of the time.

Someone know how to correctly get the IV and OI for each bar when limited to a specific Option Contract?

Ruby:
declare upper;
declare once_per_bar;

input startTime = 930;
input endTime = 1600;

def adjStartTime = startTime;# - 1;
def adjEndTime = endTime;# - 1;

def agg = GetAggregationPeriod();

# we use a 1 bar offset to get orders to line up, so adjust for that here
def marketOpen = if agg >= AggregationPeriod.DAY then 1 else if SecondsTillTime(adjEndTime) >= 60 and SecondsFromTime(adjStartTime) >= -60 then 1 else 0;

def open_int = open_interest();
def imp_vol = imp_volatility(GetUnderlyingSymbol());

AddOrder(OrderType.BUY_TO_OPEN, marketOpen, low, 1, Color.WHITE, Color.WHITE,
name = "SOHLCP|"+GetSymbol()+"|"+open_int[-1]+"|"+imp_vol[-1]);

AddOrder(OrderType.SELL_TO_CLOSE, marketOpen, high, 1, Color.WHITE, Color.WHITE);
 
Solution
I modifed a script I found on this forum and I am trying to get IV and OI of a Option.

I can see in ToS that the IV changes with every Strike whereas I can only get it to give me the IV from GetUnderlyingSymbol(), which remains the same no matter the strike
.
I'm also only able to see N/A for Open Interest most of the time.

Someone know how to correctly get the IV and OI for each bar when limited to a specific Option Contract?

Ruby:
declare upper;
declare once_per_bar;

input startTime = 930;
input endTime = 1600;

def adjStartTime = startTime;# - 1;
def adjEndTime = endTime;# - 1;

def agg = GetAggregationPeriod();

# we use a 1 bar offset to get orders to line up, so adjust for that here
def marketOpen = if agg >=...
I modifed a script I found on this forum and I am trying to get IV and OI of a Option.

I can see in ToS that the IV changes with every Strike whereas I can only get it to give me the IV from GetUnderlyingSymbol(), which remains the same no matter the strike
.
I'm also only able to see N/A for Open Interest most of the time.

Someone know how to correctly get the IV and OI for each bar when limited to a specific Option Contract?

Ruby:
declare upper;
declare once_per_bar;

input startTime = 930;
input endTime = 1600;

def adjStartTime = startTime;# - 1;
def adjEndTime = endTime;# - 1;

def agg = GetAggregationPeriod();

# we use a 1 bar offset to get orders to line up, so adjust for that here
def marketOpen = if agg >= AggregationPeriod.DAY then 1 else if SecondsTillTime(adjEndTime) >= 60 and SecondsFromTime(adjStartTime) >= -60 then 1 else 0;

def open_int = open_interest();
def imp_vol = imp_volatility(GetUnderlyingSymbol());

AddOrder(OrderType.BUY_TO_OPEN, marketOpen, low, 1, Color.WHITE, Color.WHITE,
name = "SOHLCP|"+GetSymbol()+"|"+open_int[-1]+"|"+imp_vol[-1]);

AddOrder(OrderType.SELL_TO_CLOSE, marketOpen, high, 1, Color.WHITE, Color.WHITE);

code examples that read open interest for many strikes.
take a look at this post67, and the other posts in this thread
https://usethinkscript.com/threads/option-heatmap-and-oi-strikes.10664/page-4#post-94445



===============
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:
Solution

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

bump. i would love to know how to get IV for a specific option contract symbol in thinkscript. has anyone ever done it through solving for it using black scholes type stuff?

i dont think the link halcyon guy provided above has anything about IV.
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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