Volatility percentile add in study
1) Start with eyedropper icon located in the upper right first icon of the chart screen.
Now on new popped up window
2) Click the bottom left corner "New..."
in the thinkScript Editor
Under Plot Data = Close;
3) Copy and paste this into Window.
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
periodHigh = highest ( imp_volatility(period=period),length=length);
def
periodLow = lowest ( imp_volatility(period=period), 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);
4) Click OK
5) Now Unclick the Show Plot Check mark
6) apply and OK.
Chart Window should look like this
Additional Color changing Code.
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), color = CreateColor(255-(ivp*2.55),ivp*2.55,0));
*******************************************************************************
TastyTrade Game Changers Code
input length = 10;
input price = close;
input pricePercentUP = 5.0;
input pricePercentDOWN = -5.0;
def PercentChg = Round(100 * (price / price[length] - 1), 2);
AddLabel(1, Concat ("% Price Chng:", PercentChg ),if percentChg >= pricePercentUP then color.dark_green else if percentChg <= pricePercentDOWN then color.red else color.gray);
VS
TastyTrade Game Changers Code
Price Percentile Code
- Go to 'Charts' tab
- Click on the "eye-dropper" icon (officially called "edit studies icon"...same line where you type in the ticker symbol, first icon moving left to right)
- Click on "New"... Lower left hand corner
- Delete everything in the box. (plot Data = close;)
- Paste the entire code listed in bold from below
- Name the study PricePercent
- Click 'OK'
- Click 'Apply'
- Click 'Ok'
input length = 10;
input price = close;
input pricePercentUP = 5.0;
input pricePercentDOWN = -5.0;
def PercentChg = Round(100 * (price / price[length] - 1), 2);
AddLabel(1, Concat ("% Price Chng:", PercentChg ),if percentChg >= pricePercentUP then color.dark_green else if percentChg <= pricePercentDOWN then color.red else color.gray);