• Get $30 off VIP with code SUMMER30. Ends July 27. Happy trading!

Option Volume/Open Interest Indicator for ThinkorSwim

ezrollin

Member
VIP
Can someone give me an idea on how to code a watchlist script that shows the current options I'm looking at, where they closed at the day prior?
(like on Etrade).
Thanks
 

ezrollin

Member
VIP
Sorry, I'm trying to see where the option closed at previous day for all strikes, all puts, all calls at the same time as a field on the option chain
As a column
 
Last edited:

tonyMM

New member
I'm trying to run this script but it doesn't appear to be working. I can't seem to find anything on web or in the manual that would indicate there is incorect code. I'm getting NO errors also. I'm also folowing the exact example in the manual.

input ticker = "SPY";
input expirationDate = 20200417;

plot data = close(GetNextITMOption(GetATMOption(ticker, expirationDate, OptionClass.CALL))) + close(GetNextOTMOption(GetATMOption(ticker, expirationDate, OptionClass.CALL)));

plot data2 = close(GetNextITMOption(GetATMOption(ticker, expirationDate, OptionClass.PUT))) + close(GetNextOTMOption(GetATMOption(ticker, expirationDate, OptionClass.PUT)));
 

inthefutures

Active member
you might have to wait till market opens again, sometimes options data becomes unavailable over the weekend at least it does on my RTD and googlefinance feeds
 

tonyMM

New member
Oh I see. Yes I just created this script so I haven't run it while the market was open. Thanks. Hopefuly it will work when open.
 

martinflds

New member
@BenTen Is there anyway to post a word doc or PDF? I copied all the ThinkScript instructional data off the sight onto a Word document. I use this to reference and with it all being in once spot you can clt+F what you are looking for instead of searching the site. Additionally all the parts are hyperlinked if you wanted to go to that section of TOS learning center. It's 191 pages. There are still a few things I may add like the explanations of the different types of studies and what not.
 

jlondono2002

New member
Hi guys I need your help, I'm trying to get the value of the percentage of the volume of options with respect to the volume of the stock, example if I have the volume of options CCL 05/29 Call 18 = 30K and the volume of the stock at that moment is 15 million, then ((30K * 100) / 15000000) * 100 = 20%, what would be the code that is required to place it in the watchlist to get that porcentage value??, I appreciate your help, thanks
 

Blazer990

New member
As the title implies, I basically want to create a custom study that multiplies the option price by volume and filters out options that don't fulfill this criteria. An example would be something like: (OptionPrice * 100) * Volume >= 250000.

I've messed around with the Volume and OptionPrice on ThinkScript to see if this could be possible but I've hit a roadblock. When using Volume, it seems that it's strictly filtering stock volume and not option volume... and OptionPrice seems to filter differently as well.
 

topmarx

New member
VIP
This is the best version of options volume integration I have found, as they found a way to not have to manually input the contracts, so you can look at any symbol and it automatically picks up the top 5,10,20 strikes for that symbol.

https://www.futurestrad3r.com/shop
spxvolume.png
 
Last edited:

mjac101

New member
@topmarx Has this indicator been useful for you? Do you use on it on futures or equities? I was looking exactly for something like this that visualizes the Time & Sales data. However it is nearly impossible to know the direction of the buy/sell of the call/put. As described in futurestrad3r article if it's on the Bid/Ask is how they make their assumption along with the price action. https://www.futurestrad3r.com/post/how-to-trade-using-our-option-volume-indicator
 

joedubyk

New member
It would probably be WAY more useful to see which levels have the most call/put volume at... If we have lots of OTM puts and price goes UP, that's going to create squeezey environemnts.
 

Zardoz0609

New member
I modified the code quite a bit and automated it to use the currently selected symbol... Just a heads up, this takes a minute to load because it looks through quite a lot of data.


Code:
# Put/Call
# 11.9.2019

declare lower;

def series = 1;
def Strike = Round(close(symbol = GetSymbol()) / .5, 0) * .5;
def CurrentYear = GetYear();
def CurrentMonth = GetMonth();
def CurrentDOM = GetDayOfMonth(GetYYYYMMDD());
def Day1DOW1 = GetDayOfWeek(CurrentYear * 10000 + CurrentMonth * 100 + 1);
def FirstFridayDOM1 = if Day1DOW1 < 6
                          then 6 - Day1DOW1
                          else if Day1DOW1 == 6
                          then 7
                          else 6;
def RollDOM = FirstFridayDOM1 + 14;
def ExpMonth1 = if RollDOM > CurrentDOM
                    then CurrentMonth + series - 1
                    else CurrentMonth + series;
def ExpMonth2 = if ExpMonth1 > 12
                    then ExpMonth1 - 12
                    else ExpMonth1;
def ExpYear = if ExpMonth1 > 12
                  then CurrentYear + 1
                  else CurrentYear;
def Day1DOW = GetDayOfWeek(ExpYear * 10000 + ExpMonth2 * 100 + 1);
def FirstFridayDOM = if Day1DOW < 6
                         then 6 - Day1DOW
                         else if Day1DOW == 6
                         then 7
                         else 6;
def ExpDOM = FirstFridayDOM + 14;
def date = ExpYear * 10000 + ExpMonth2 * 100 + ExpDOM + 1;

def PutTotal = fold index = -10 to 10 with s = 0 do s + volume(Concat(Concat(Concat(".", GetSymbol()), Concat(AsPrice(date - 20000001), "P")), index + Strike));
def CallTotal = fold i = -10 to 10 with r = 0 do r + volume(Concat(Concat(Concat(".", GetSymbol()), Concat(AsPrice(date - 20000001), "C")), i + Strike));


def CallVolume = if IsNaN(volume(symbol = GetATMOption(GetSymbol(), date, OptionClass.CALL)))
                     then CallVolume[1]
                     else volume(symbol = GetATMOption(GetSymbol(), date, OptionClass.CALL));


AddLabel(yes, (Concat("Ex date: ",
              Concat(ExpMonth2,
              Concat("/",
              Concat(ExpDOM,
              Concat("/",
              Concat(AsPrice(ExpYear), ""))))))), Color.WHITE);
AddLabel(1, "Strikes " + GetSymbol() + ": $" + Strike, Color.WHITE);
AddLabel(yes, Concat("ATM Put/Call Ratio ", Round(PutTotal / CallTotal, 2)), Color.WHITE);
AddLabel(yes, Concat("ATM Put Volume ", PutTotal), Color.WHITE);
AddLabel(yes, Concat("ATM Call Volume ", CallTotal), Color.WHITE);
def PV = if IsNaN(PutTotal)
            then PV[1]
            else PutTotal;
def CV = if IsNaN(CallTotal)
            then CV[1]
            else CallTotal;
plot ChangeRatio = if IsNaN(close) then Double.NaN else PV / CV;
ChangeRatio.AssignValueColor(if ChangeRatio > 1
                 then Color.GREEN
                 else Color.RED);
# End Study
 

axlerod

Member
@Zardoz0609 Thank you been trying to find something like this. Only thing it shows only labels, there are no lines or anything else? Is there supposed to be lines because having lines for calls puts) like the original pic people are trying to find on page 1 would be incredible helpful since I am visual person.

Also what time frame does this work on ? Thank you!
 

Zardoz0609

New member
@axlerod I simplified the plot down to what I really wanted to see which was the days in which there was a significant rise in the p/c ratio (it can take a minute to load because it sorts through a lot of data). It wouldn’t be too difficult to put an average back in if you would like, but it made the graph look quite busy. Essentially what this does now is it looks at the put and call volume at +/- 5 strikes from the ATM strike for every single day shown on your chart. The P/C ratio and volume at the top is just for the current day, but the graph goes as far back as the chart you have pulled up.
 

Similar threads

Top