NexusFi: Find Your Edge


Home Menu

 





Thinkorswim custom script for Stock/ETF / volatility percent percentile range


Discussion in ThinkOrSwim

Updated
      Top Posters
    1. looks_one alchemist74 with 2 posts (3 thanks)
    2. looks_two rmejia with 2 posts (0 thanks)
    3. looks_3 contrails with 2 posts (0 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 22,964 views
    2. thumb_up 5 thanks given
    3. group 9 followers
    1. forum 11 posts
    2. attach_file 1 attachments




 
Search this Thread

Thinkorswim custom script for Stock/ETF / volatility percent percentile range

  #1 (permalink)
 peroulias 
Los Angeles California USA
 
Experience: Intermediate
Platform: thinkorswim
Trading: Stocks
Posts: 2 since Jan 2012
Thanks Given: 3
Thanks Received: 0

Is any existing Thinkorswim custom script for stock/ETF to generate the 52 week volatility percent percentile range? This script will be helpful to determine the degree of volatility for individual stocks and under underlines
Thanks

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Exit Strategy
NinjaTrader
Futures True Range Report
The Elite Circle
New Micros: Ultra 10-Year & Ultra T-Bond -- Live Now
Treasury Notes and Bonds
NexusFi Journal Challenge - April 2024
Feedback and Announcements
Better Renko Gaps
The Elite Circle
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
61 thanks
Funded Trader platforms
39 thanks
NexusFi site changelog and issues/problem reporting
26 thanks
Battlestations: Show us your trading desks!
26 thanks
The Program
18 thanks
  #3 (permalink)
 brevco 
Denham Springs, LA
 
Experience: Advanced
Platform: Amibroker / Ninja Trader
Broker: Mirus Zenfire
Trading: TF 6E NQ
Posts: 194 since May 2010
Thanks Given: 259
Thanks Received: 187



peroulias View Post
Is any existing Thinkorswim custom script for stock/ETF to generate the 52 week volatility percent percentile range? This script will be helpful to determine the degree of volatility for individual stocks and under underlines
Thanks


I am not aware of any script for this, but long ago I used to use Larry McMillan's website to find
the percentile volatility for a stock. It is free and I believe it is updated at the end of every week.
The website has changed since I used it, but I actually found the link.

Free weekly [AUTOLINK]implied volatility[/AUTOLINK], historical [AUTOLINK]volatility[/AUTOLINK] and [AUTOLINK]volatility[/AUTOLINK] percentile data | Option Strategist

You can download (copy and paste) this data into an Excel spread sheet and sort according to your needs.
If you prefer not to download that data for thousands of stock and indexes, you can just search for a
specific stock by doing Control F and type the stock symbol.

If no one responds with a script, then perhaps this might help as far as accessing the data you
are looking for.

Reply With Quote
  #4 (permalink)
 Kona 
San Francisco
 
Experience: Advanced
Platform: NinjaTrader
Posts: 6 since Jun 2009
Thanks Given: 13
Thanks Received: 7

Current IV percentile is provided under "Today's option statistics" on the trade page.

Reply With Quote
  #5 (permalink)
 alchemist74 
Sofia, Bulgaria
 
Experience: Advanced
Platform: IB,TOS
Broker: IB
Trading: Options,ES,6E,ZB,SPX,RUT,CL
Posts: 47 since Jul 2010
Thanks Given: 6
Thanks Received: 42


peroulias View Post
Is any existing Thinkorswim custom script for stock/ETF to generate the 52 week volatility percent percentile range? This script will be helpful to determine the degree of volatility for individual stocks and under underlines
Thanks

I am not sure if this is what u looking for but worth nothing to try it


declare lower;

input period = 30;

input type = {default IV, HV, IVminusHV, ParkinsonHV, Range};

#ParkinsonHV
def hlReturn = Log(high / low);
def hlConstant = 1 / (4 * Log(2) * period);




def v;
switch (type)
{
case IV:
v = impVolatility();
case HV:
v = HistoricalVolatility(period);
case IVminusHV:
v = ImpVolatility() - HistoricalVolatility(period);
case ParkinsonHV:
v = Sqrt( Sum( hlConstant * Sqr(hlReturn), period) ) * Sqrt(252);
case Range:
v = high - low;
}

def rank = fold index = 1 to period with perRank = 0 do perRank + (GetValue(v, index, period) < v) ;

plot pvr = (rank / period) * 100) ;


plot Zero = 0;
plot Ten = 10;
plot TwentyFive = 25;
plot SeventyFive = 75;
plot Ninty = 90;
plot Hundred = 100;

EDIT: Because I do not know how, if anyone wants can upload the code in the downloads section. Of course if you think it is useful .

Reply With Quote
  #6 (permalink)
 contrails 
san diego CA/USA
 
Experience: Beginner
Platform: SC, TOS
Trading: ES, CL
Posts: 35 since Aug 2013
Thanks Given: 24
Thanks Received: 12


alchemist74 View Post
I am not sure if this is what u looking for but worth nothing to try it


declare lower;

input period = 30;

input type = {default IV, HV, IVminusHV, ParkinsonHV, Range};

#ParkinsonHV
def hlReturn = Log(high / low);
def hlConstant = 1 / (4 * Log(2) * period);




def v;
switch (type)
{
case IV:
v = impVolatility();
case HV:
v = HistoricalVolatility(period);
case IVminusHV:
v = ImpVolatility() - HistoricalVolatility(period);
case ParkinsonHV:
v = Sqrt( Sum( hlConstant * Sqr(hlReturn), period) ) * Sqrt(252);
case Range:
v = high - low;
}

def rank = fold index = 1 to period with perRank = 0 do perRank + (GetValue(v, index, period) < v) ;

plot pvr = (rank / period) * 100) ;


plot Zero = 0;
plot Ten = 10;
plot TwentyFive = 25;
plot SeventyFive = 75;
plot Ninty = 90;
plot Hundred = 100;

EDIT: Because I do not know how, if anyone wants can upload the code in the downloads section. Of course if you think it is useful .

hi I entered your code but it is giving me an error at line 31! if you get a chance can you follow up please?

Reply With Quote
  #7 (permalink)
 
rmejia's Avatar
 rmejia 
Puerto Rico
 
Experience: Intermediate
Platform: thinkorswim
Broker: TD Ameritrade
Trading: Options
Posts: 379 since Oct 2010
Thanks Given: 3,614
Thanks Received: 441


contrails View Post
hi I entered your code but it is giving me an error at line 31! if you get a chance can you follow up please?

It's just missing a parenthesis at the beginning:

plot pvr = ((rank / period) * 100) ;

or remove the one at the end:

plot pvr = (rank / period) * 100 ;

Reply With Quote
  #8 (permalink)
 contrails 
san diego CA/USA
 
Experience: Beginner
Platform: SC, TOS
Trading: ES, CL
Posts: 35 since Aug 2013
Thanks Given: 24
Thanks Received: 12

Not really sure what this study accomplishes in plain English though

Reply With Quote
  #9 (permalink)
 
rmejia's Avatar
 rmejia 
Puerto Rico
 
Experience: Intermediate
Platform: thinkorswim
Broker: TD Ameritrade
Trading: Options
Posts: 379 since Oct 2010
Thanks Given: 3,614
Thanks Received: 441


contrails View Post
Not really sure what this study accomplishes in plain English though

lol, yeah me neither.

Going back to the original poster "IV_Percentile" was added to the scan criteria a couple of months ago which is something nice to easily see if you sell options:


Reply With Quote
  #10 (permalink)
 alchemist74 
Sofia, Bulgaria
 
Experience: Advanced
Platform: IB,TOS
Broker: IB
Trading: Options,ES,6E,ZB,SPX,RUT,CL
Posts: 47 since Jul 2010
Thanks Given: 6
Thanks Received: 42



contrails View Post
hi I entered your code but it is giving me an error at line 31! if you get a chance can you follow up please?

Hi,
sorry i delayed my answer but i trade very heavily last few months. I find better TOS code for IV rank, here it is:

def vol = imp_volatility;
#rec data = if !isNaN(vol) then vol else data[1];
def data = vol;
def hi = highest(data,252);
def lo = lowest(data,252);
def perct = round((data - lo)*100/ (hi - lo),0);
plot x = perct;
plot H = 90;
plot L = 20;

this will draw a line tool bellow your chart . If u want to see just a number at your left chart corner use this:

declare upper;
input period = AggregationPeriod.DAY ;

input length =252 ;

def ivGapHi = if isnan(imp_volatility(period=period)) then 99999999999 else imp_volatility(period=period);
def ivGapLo = if isnan(imp_volatility(period=period)) then -99999999999 else imp_volatility(period=period);
def periodHigh = highest( ivGapLo,length=length);
def periodLow = lowest( ivGapHi, length=length);
def ivRange = periodHigh - periodLow ;
def ivp = round( 100*(imp_volatility(period=period) - periodLow)/ivRange, 0);
AddLabel(1, Concat("IV%: ", ivp), color = Color.PLUM);

Reply With Quote
Thanked by:




Last Updated on January 19, 2015


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts