Implied Volatility Suite

This is an updated, more robust, and open source version of my 2 previous scripts : "Implied Volatility Rank & Model-Free IVR" and "IV Rank & IV Percentile".

This specific script provides you with 4 different types of volatility data: 1)Implied volatility , 2) Implied Volatility Rank, 3)Implied Volatility Percentile, 4)Skew Index.

1) Implied Volatility is the market's forecast of a likely movement, usually 1 standard deviation, in a securities price.

2) Implied Volatility Rank, ranks IV in relation to its high and low over a certain period of time. For example if over the past year IV had a high of 20% and a low of 10% and is currently 15%; the IV rank would be 50%, as 15 is 50% of the way between 10 & 20. IV Rank is mean reverting, meaning when IV Rank is high (green) it is assumed that future volatility will decrease; while if IV rank is low (red) it is assumed that future volatility will increase.

3) Implied Volatility Percentile ranks IV in relation to how many previous IV data points are less than the current value. For example if over the last 5 periods Implied volatility was 10%,12%,13%,14%,20%; and the current implied volatility is 15%, the IV percentile would be 80% as 4 out of the 5 previous IV values are below the current IV of 15%. IV Percentile is mean reverting, meaning when IV Percentile is high (green) it is assumed that future volatility will decrease; while if IV percentile is low (red) it is assumed that future volatility will increase. IV Percentile is more robust than IV Rank because, unlike IV Rank which only looks at the previous highs and lows, IV Percentile looks at all data points over the specified time period.

4)The skew index is an index I made that looks at volatility skew. Volatility Skew compares implied volatility of options with downside strikes versus upside strikes. If downside strikes have higher IV than upside strikes there is negative volatility skew. If upside strikes have higher IV than downside strikes then there is positive volatility skew. Typically, markets have a negative volatility skew, this has been the case since Black Monday in 1987. All negative skew means is that projected option contract prices tend to go down over time regardless of market conditions.

Additionally, this script provides two ways to calculate the 4 data types above: a)Model-Based and b)VixFix.

a) The Model-Based version calculates the four data types based on a model that projects future volatility . The reason that you would use this version is because it is what is most commonly used to calculate IV, IV Rank, IV Percentile, and Skew; and is closest to real world IV values. This version is what is referred to when people normally refer to IV. Additionally, the model version of IV, Rank, Percentile, and Skew are directionless.

b) The VixFix version calculates the four data types based on the VixFix calculation. The reason that you would use this version is because it is based on past price data as opposed to a model, and as such is more sensitive to price action. Additionally, because the VixFix is meant to replicate the VIX Index (except it can be applied to any asset) it, just like the real VIX , does have a directional element to it. Because of this, VixFix IV, Rank, and Percentile tend to increase as markets move down, and decrease as markets move up. VixFix skew, on the other hand, is directionless.

How to use this suite of tools:

1st. Pick the way you want your data calculated: either Model-Based or VixFix.

2nd. Input the various length parameters according to their labels:

  • If you're using the model-based version and are trading options input your time til expiry, including weekends and holidays. You can do so in terms of days, hours, and minutes. If you're using the model-based version but aren't trading options you can just use the default input of 365 days.

  • If you're using the VixFix version, input how many periods of data you want included in the calculation, this is labeled as "VixFix length". The default value used in this script is 252.

3rd. Finally, pick which data you want displayed from the dropdown menu: Implied Volatility , IV Rank, IV Percentile, or Volatility Skew Index.
Информация о релизе: A mathematical error in the Model-Based Volatility Smile has been addressed. Also the code for the Model-Based and VixFix volatility smiles are condensed into functions.
Информация о релизе: Condensed code further.
Информация о релизе: A point that I want to make clear is that the IV values given by the model IV do not match up one to one with brokerage IV values because of the fact that on TV we don't have access to actual option prices. There are various formulas that can be used to approximate IV. The model IV in this indicator uses a formula that does not require option prices to calculate IV. I hope this clears up any confusion.
Информация о релизе: I updated the model IV's calculation, and it is now more accurate than the previous version. As stated in a previous update because this model uses a formula that does not involve option prices the IV values will not be exactly the same as IV provided from external sources such as brokers, exchanges, etc; but are close enough.

A disclaimer that I want to mention, is that I don't recommend using this script if your expiry is more than 100 days. The IV values become way off if the expiry is more than 100 days.

Additionally, in this new update you now have the ability to choose the length of time that you want to use in calculating the rank and percentile values. This should fix any previous issues with the script not showing anything when being applied relatively new assets that don't have a lot of price data.

I hope this update and clarification helps!
Скрипт с открытым кодом

В истинном духе TradingView автор этого скрипта опубликовал его с открытым исходным кодом, чтобы трейдеры могли понять, как он работает, и проверить на практике. Вы можете воспользоваться им бесплатно, но повторное использование этого кода в публикации регулируется Правилами поведения. Вы можете добавить этот скрипт в избранное и использовать его на графике.

Хотите использовать этот скрипт на графике?