InvestorsHub Logo
Followers 43
Posts 22767
Boards Moderated 2
Alias Born 10/16/2008

Re: None

Sunday, 01/05/2014 8:45:29 PM

Sunday, January 05, 2014 8:45:29 PM

Post# of 3631
Price Percentile Script:
from Tasty Trade/TOS

1) Go to 'Charts' tab
2) Click on the "eye-dropper" icon (officially called "edit studies icon"...same line where you type in the ticker same symbol, first icon moving left to right)
3) Click on "New"... Lower left hand corner
4) Delete everything in the box. (plot Data = close;)
5) Paste the entire code listed below
6) Name the study PricePercent
7) Click 'OK'
8) Click 'Apply'
9) Click 'Ok'

input length = 10;
input price = FundamentalType.CLOSE;
input pricePercentUP = 5.0;
input pricePercentDOWN = -5.0;

def priceday= Fundamental(price,period = aggregationPeriod.DAY);
def high=Highest(priceday[1],length);
def low=Lowest(priceday[1],length);
def PcntChHigh= 100 * (priceday / high -1);
def PcntChLow= 100 * (priceday /low -1);
def PercentChg = if(AbsValue(PcntChHigh)>=AbsValue(PcntChLow),
Round(PcntChHigh, 2),
Round(PcntChlow, 2));

AddLabel(1, Concat ("% Price Chng:", PercentChg ),if percentChg >= pricePercentUP then color.dark_green else if percentChg <= pricePercentDOWN then color.red else color.gray);
------------------------------------------------------------------------------------------------------
IV Percentile Script:

1) Go to 'Charts' tab
2) Click on the "eye-dropper" icon (officially called "edit studies icon"...same line where you type in the ticker same symbol, first icon moving left to right)
3) Click on "New"... Lower left hand corner
4) Delete everything in the box. (plot Data = close;)
5) Paste the entire code listed below
6) Name the Study
7) Click 'OK'
8) Click 'Apply'
9) Click 'OK'

declare upper;
input period = AggregationPeriod.DAY ;
#hint period: time period to use for aggregating implied volatility.
input length =252 ;
#hint length: #bars to use in implied volatility calculation.
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), if ivp > 80
then Color.Green
else if ivp < 80 and ivp > 50
then Color.Yellow
else color.Red);

Hints:
a) Use 252 as input length for 1-year or 52-week IV percentile
b) You can change 252 to 189 for 9-month IV percentile
c) You can change 252 to 126 for 6-month IV percentile

Disaster is Only a Keystroke Away!

Join the InvestorsHub Community

Register for free to join our community of investors and share your ideas. You will also get access to streaming quotes, interactive charts, trades, portfolio, live options flow and more tools.