A Better Implied Volatility Rank and Percentile Indicator

Forums ProRealTime English forum ProBuilder support A Better Implied Volatility Rank and Percentile Indicator

This topic contains 22 replies, has 2 voices, and was last updated by avatar Vonasi 7 months, 3 weeks ago.

Currently, there are 0 users and 1 guest visiting this topic.
View all attachments
Viewing 15 posts - 1 through 15 (of 23 total)
  • #110480


    Hi, I think this would be a very useful addition to the library and am wondering if it is possible to code an Implied Volatility Rank and Percentile Indicator that can be based on Williams’ Vix Fix? It would be particularly beneficial for Currency, Indices and Options traders but can be applied to most markets.

    The PRC version of the indicator was posted here: https://www.prorealcode.com/topic/indicator-request-for-nic/

    Can it also be programmed so that it can find tops as well as bottoms, — i.e. instead of just having a fear barometer when Put Premiums are rising sharply, also have a greed barometer for Call Premium rises and potential market tops)? I was hoping we could have an indicator like this one I found on Trading View (linked below) so it shows not just the IV rank but also the Percentile (so it’s scaled by 100%)? Unfortunately the code is locked on Trading View but I am hoping it isn’t too far of the version I linked to above on PRC.


    “This indicator is meant to be a substitute for Implied Volatility Rank and Percentile for traders who do not have access to readily available options data. This indicator is based on the William’s VixFix which is an indicator that mirrors the VIX , which charts the implied volatility of the SPX . The great thing about the VixFix is that it can be applied to any security, not just the SPX .

    IV Rank is calculated by taking the highest and lowest values over the past however many periods you choose, and seeing what percentage of the way between those values the current IV value is. For example if over the past 5 periods the highest IV value was 30 and the lowest IV value was 10, and the current is 20; then the IV Rank would be 50% because 20 is 50% of the way between 10 & 30.

    IV Percentile is calculated by looking at all of the past values, not just the highest and lowest, and seeing how many of those values were below the current. (IVP tells you the percentage of time that the IV in the past has been lower than current IV). For example lets say over the past five periods the IV values were : 30,10,11,15, & 17; while the current IV value is 20. As stated before the IV Rank would be 50%, while the IV Percentile would be 80%, given that 4/5 of the values were below the current IV value of 20.

    IV Rank and IV Percentile are often wrongly used interchangeably, but as shown here they are very different. Most people use IV Rank as their main options tool; while IV percentile is a great way to give IV Rank context. Whichever you choose to use, or even both, does not really matter as long as you use either one or both consistently.

    IV Rank and IV Percentile are mainly used in this way: when IVR/IVP <50, buy options, when IVR/IVP >50 sell options. The reason that you buy options when IVR/IVP is low is because IV is mean reverting, so you would expect IV to eventually start increasing towards the mean, causing prices to move. The reason you would sell options when IVR/IVP is high is because IV is mean reverting and you would expect IV to decrease towards the mean, causing prices to move sideways.

    In this script there are two lines, one denoting IVR and one denoting IVP . IVR is the line which is green when it’s above 50 and red when below 50. IVP is the line which is aqua when above 50 and orange when below 50.“

    Also, I was wondering why “pl” is set at 1.01 instead of 0.15 and I also do not get the green histogram bars (mine are all grey despite color code within indicator) on the ProRealCode version mentioned above?

    Thanks very much,

    Cheers Bard.


    It should be possible. I’ll try and have a go at it.


    Try this. I think I understood the description correctly. If you can confirm that it is as expected then I might submit it to the library.


    1. IVR-and-Percentile.itf

    IV Rank and IV Percentile are mainly used in this way: when IVR/IVP <50, buy options, when IVR/IVP >50 sell options

    I think you might have this the wrong way round. Unless I have coded it back  to front (which I don’t think I have) the opposite seems to be true when I look at a chart.


    Wow, thanks very much, that was quick @vonasi!
    The indicator signals may be poor but it is referring to whether you’re a buyer or seller (writer) of Puts and Calls. It maybe that using a 50% mean value IVR/IVP ratio and expecting meaningful signals maybe naive given the way option premiums can explode and remain high for extended periods of time. (Pls refer to £/$ weekly Call options that have increased by 100’s of percent and remained high since the 11th October due to a possible Brexit deal).

    When IVR / IVP < 50, buy call or put options (because premiums are cheap and should rise to the mean value). When IVR / IVP > 50 sell (write) call or put options (because premiums are expensive and should reduce so you can buy them back cheap and close the position for a profit).

    I’ve been reading more on this! Is this best way to make a IVR / IVP Indicator? The PRC Vix Fix green spike barchart is very clear. Are the substitute formulas to approximate for Implied Volatility (which predicts an assets expected future movement) and Historical Volatility good enough though?

    Implied Volatility:

    The Vix represents future 30 day Implied Volatility for the S&P 500. Larry Williams’ I Really Trade website: https://www.ireallytrade.com/newsletters/VIXFix.pdf

    explains how high readings = high volatility (good for option (short) sellers of Calls or Puts as premiums explode in value). Williams’ duplicates this implied volatility Vix index with his simple formula: 

    and the VIX and WFV chart indicators look pretty similar.

    Obviously the only real way to work out IV is to back calculate it out of the Black Scholes (BS) option Pricing Model using an options calculator as it has to reference the strike price and underlying price and represents a 1 std deviation move on an annual basis. I see formulas on Trading View using 365 days and 252 days, the former makes more sense as the BS Model references the risk free interest rate — for example — annual Gilt or Treasury Bill Rates.

    Examples of Implied Volatility Calculations:

    US Crude Price = $66
    Strike Price for a Put option = $63
    Implied Volatility = 24.95% (annual)
    Therefore there is a 68% chance of the price being +/- $16.46 within a year ($66 x 0.2495).

    Therefore expect:

    1 Std Dev      – 68% probability of the oil closing between $49.54 and $82.46 a year from now
    2 Std Dev      – 95% probability of the oil closing between $33.08 and $98.92 a year from now
    3 Std Dev      – 99.7% probability of the oil closing between $16.62 and $115.38 a year from now

    Percentages are derived from the BS Model:
    Strikes with a probability of 16% being In the Money at expiration make them more likely to be profitable for a buyer of Calls and Puts) / 84% Out the Money at expiration make them more likely to be profitable for a buyer of Calls and Puts) and these percentages  capture a 1 standard deviation range for an OTM option.

    Strikes with a probability of 2.5% ITM / 97.5% OTM capture a 2 standard deviation range for an OTM option.

    (Stock price) x (Annualised Implied Volatility) x (Square Root of [days to expiration / 365]) = 1 standard deviation.

    Example of AAPL that is trading at $323.62. The current Implied Volatility is 31.6%.
    JAN options expire in 22 days, that would indicate that standard deviation is: $323.62 x 31.6% x SQRT (22/365) = $25.11
    That means that there is a 68% chance that AAPL will be between $298.51 and $348.73 in January expiration.


    Historical Volatility:

    From Trading View: https://www.tradingview.com/script/lqwz92Fm-Historical-Volatility-Rank/

    Referring back to the original Vix Fix post: https://www.prorealcode.com/topic/indicator-request-for-nic/#post-110244
    and http://ninza.co/product/williams-vix-fix

    Imagine an indicator as good as the PRC green high Vix Fix Volatility spike bar but also with Low spikes included to spot extreme measures of greed (for Shorting) and then also with an IVR/IVP ratio threshold showing perhaps better extremes like 20%, (and the mean threshold of 50%) and 80%. Pls see images.

    Do any of these “musings” help you any Vonasi !?

    Ps/ Why could I not get the PRC Vix Fix code to show green extreme bars?


    Sorry Bard but you lost me at ‘Wow, thanks very much’.

    It was all ‘Warning – brain says information overload’ after that! 🙂

    1 user thanked author for this post.

    😄 It took me ages to write that,  I thought this would be “childs’ play” for a skilled coder like yourself! Maybe you could find a dark room and lie down for a while!? 😂

    Basically I think the IV and HV formulas could be improved (log) but it would, at least for now, be great to see the PRC Vix Fix green spike indicator bounded by 100% and with extreme Low Volatilities for market tops? Then maybe I can figure out how to make a separate IV Percentile indicator.


    I can fix your last issue with some simple code changes. This should give you a green and grey histogram:



    …and this is a version of the VixFix within 0 to 100 boundaries. Not what you are after I think but maybe useful?


    1 user thanked author for this post.

    Roberto off forum pointed out a minor error in the calculation of wvflev. I have now corrected it in the code in the post and replaced the ITF file with a corrected one.

    2 users thanked author for this post.

    Great, thanks very much for taking another look at this @vonasi and for the wvflev amendment @Robertogzzi. I had no internet today as I had British Telecom in fixing a phone fault so I’ll take a proper look tomorrow or Monday.

    One thing I noticed on Trading View is that they use a logarithmic version for calculating the HV as mentioned in my post above. I wonder if that will give better signals? But maybe then it can’t be regarded as a Vix Fix?

    Also, is it quite complicated to make the indicator show the Low volatility periods (Market peaks)? It may be a good idea to have it display in the format of that Ninja Trader image which is displaying data from a centered mid point x-axis and not displaying from the bottom of the x-axis as per the PRC indicator? (I’ll repost it here to save you looking for it).

    Cheers, have a great weekend.


    I’m afraid that I have absolutely no skills when it comes to converting other code formats to ProRealCode. I coded the last indicator that I provided purely by using your description of how it should be and adapting the logic into the code…. and only because I thought that it was an interesting coding challenge – some people do crosswords to keep their brain moving and some people try to turn a description into an indicator!

    I can’t just look at an image and then code something that looks just like the image without an exact description of the logic behind it.

    Perhaps if you can provide the actual code for the indicator in the image then Nicolas will be able to convert it as that is his speciality as a coding machine! 🙂


    I think the moderators on this are forum are all coding machines! I mean that in the sense that it never ceases to impress me how you all get your minds round the math and coding language challenges — and not in the sense that you’re here just to deliver code on demand like machines!

    1 user thanked author for this post.

    Here’s a dropbox link  https://www.dropbox.com/sh/bcmihvkefjf98cj/AAADlrHpNFlekHHtIe1vSVjJa?dl=0 to the Ninja Trader 8 Williams Vix Fix code (in #C) shown in the image above and sourced from here: https://ninza.co/product/williams-vix-fix

    It derives from Trading View’s Chris Moody who based it on Williams’ Vix Fix pdf article on his Ireallytrade site (linked in my post above).

    Williams: Low volatility is more often associated with market peaks, while high volatility is associated with market lows.

    My thoughts are that because it is an approximation for the Vix — which represent traders’ expectations of (implied) volatility over the next 30 days — it should be used on a daily chart (not 15 mins) and with p = 365 periods to approximate to the Black Scholes option pricing model of implied volatility of a 1 Std Deviation move on an annual basis. When it’s set to 365 only the more significant high volatility bottoms are signified, so there’s less false entries.

    Chris Moody also added an interesting feature — please see https://vimeopro.com/user32804960/tradingview-indicators/video/115923112 at 8 mins 25 secs — which is to add an alert panel signifying the bar after the last green bar to signal when to enter, (so you don’t buy in too early on all those initial green bars as the market is till falling). The real way to avoid that though is to increase the values like the ph percentile number up to 95% or 99%. To make the original PRC Vix Fix  indicator more sensitive and accurate, these more extreme readings below give less chance of false entries on Indices (which have an inbuilt Long bias). It works well on Silver and the £/$ if values lb are set to 99 and ph to 0.99. (For those selling (writing) options I can’t stress how important it is to sell only at the very highest current volatilities (when premiums are going through the roof) and to enter only when there is a genuine sign that the market premiums (fear factor) are reversing).

    Without having seen the Ninza code though it’s difficult to comment on exactly what they have done with Williams’ Vix Fix code and if it would improve by using a different equation for the WVF like the Trading View logarithmic version for calculating the HV posted a few comments above. Whatever, the fact that it spots high volatility bottoms and low volatility tops is a good idea for all traders including option sellers (writers).

    Thanks, Bard.


    Why 365? There are not 365 bars in a year due to weekends and holidays.

    This might be of interest:


    1 user thanked author for this post.
Viewing 15 posts - 1 through 15 (of 23 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login