thinkScript for Option Volume Twice the Option Open Interest

calvingee

New member
Hello thinkScript wizards, trying to setup a scan for option volume twice the option open interest for the same strike date. Need a thinkScript to insert into the editor. Any guidance or help would be appreciated. Not code literate.

Thanks in advance.
 

samks_30

New member
2019 Donor

calvingee

New member
@samsk_30 thanks for the quick reply. When I insert into editor I get an error message --> No such function: GetATMOption

Also, can it be coded without specifying the DOE and scan all of them. I will use a filter for DOE's less than 60 days.
 

tomsk

Well-known member
VIP
@calvingee No, GetATMOption() is not available within the scanner, that's why you see the message as displayed

I have seen studies with code using GetATMOption within a study. Additionally I have also used it in the past within a user defined custom quote within an option chain. That helps me to flag strikes where the volume is greater than the open interest
 

Superfast

New member
Hello, can someone create a script that scans for options with the highest change in open interest from the previous session e.g. day or hour, 5 min etc. Perhaps a % change may be most suitable.
 

tomsk

Well-known member
VIP
Cindy Faber TOS: Select one of the custom watchlist columns and replace code in it with this. Then open option chain and select your new custom column's name as an option chain column.

IMPORTANT REMINDER: per industry regulation OI is updated only once/day, a few hours after market close.

Unfortunately, fields like Option Volume, Open Interest are not available to scan against. I recently tuned in to the Thinkscript lounge where this specific issue was discussed.

Code:
#HINT: this is a custom watchlist column that can be selected as a column on a watchlist of option symbols and/or as a column on the option chain


plot OI_NetChg = open_interest() - open_interest()[1];
OI_NetChg.SetDefaultColor(color.BLACK);
AssignBackgroundColor(if OI_NetChg > 0 then color.GREEN
                                                                          else if OI_NetChg < 0
                                                                                  then color.RED
                                                                                  else color.GRAY);


Or a more space efficient version:


def OI_NetChg = open_interest() - open_interest()[1];
AddLabel(yes, Round(OI_NetChg, 0), color.BLACK);
AssignBackgroundColor(if OI_NetChg > 0 then color.GREEN
                                                                          else if OI_NetChg < 0                             
                                                                                  then color.RED
                                                                                  else color.GRAY);


here is another way to use one of your custom columns to create an option chain column:


#HINT: this is a custom watchlist column that can be selected as a column on a watchlist of option symbols and/or as a column on the option chain.  It is blank if volume is lower than open_interest allowing it to act as an alert by only appearing when volume is higher than open_interest


def alert = volume > open_interest;
AddLabel(yes, if alert then "volume vs OI" else ".", color.BLACK);
AssignBackgroundColor(if alert == 1 then color.RED else color.LIGHT_GRAY);
 

xexykid

New member
Hi all, Does any one know in thinkscript "Option Time & Sales", how to call this highest traded option's DOE, Class etc? (and also the second biggest option, etc) Any such example scripts available anywhere? Thanks!

N4I6QgO.png
 

rad14733

Well-known member
VIP
I haven't checked in the past week but all of the Option functions were broken after a recent TOS update... The functions weren't working anywhere, not even in Studies or Strategies...
 

Rudy

New member
is there a possibility of writing a Scan code of peramenter
[ today's volume>open interest by 200% and with days to expire of less than 180 and 50% or more traded on the offer ]
 

rad14733

Well-known member
VIP
is there a possibility of writing a Scan code of peramenter
[ today's volume>open interest by 200% and with days to expire of less than 180 and 50% or more traded on the offer ]

Yes, I'm sure you could code that... Break it down into pieces-parts and go from there... Divide and conquer rather than starting out overly complex from the get-go... Get you logic for each part right and then link it all together... You can do this... (y)
 

XeoNoX

Well-known member
VIP
is there a possibility of writing a Scan code of peramenter
[ today's volume>open interest by 200% and with days to expire of less than 180 and 50% or more traded on the offer ]
you can possibly do this from a chart, but not from the scanner as TOS doesnt allow the using of custom scripts to scan against options related data. However the study would be long tedious and complex code and the fact it hasnt been even remotely done yet (or at least not publicly) makes it a large task to accomplish as you would have define the entire option chain for the instrument. In reality you are pretty much stuck with whatever parameters TOS provides you with in the default option hacker scanner parameters. And last but not least there is no way for tos to scan against if the transaction was on the bid or ask.
 

Similar threads

Top