Indicator request for Nic : CM_Williams_Vix_Fix
01/06/2017 at 11:27 AM #20017
Could you please convert the VIX Fix for PRT please? Link.
Here is the Pine Script code:
pd = input(22, title=”LookBack Period Standard Deviation High”)
bbl = input(20, title=”Bolinger Band Length”)
mult = input(2.0 , minval=1, maxval=5, title=”Bollinger Band Standard Devaition Up”)
lb = input(50 , title=”Look Back Period Percentile High”)
ph = input(.85, title=”Highest Percentile – 0.90=90%, 0.95=95%, 0.99=99%”)
pl = input(1.01, title=”Lowest Percentile – 1.10=90%, 1.05=95%, 1.01=99%”)
hp = input(false, title=”Show High Range – Based on Percentile and LookBack Period?”)
sd = input(false, title=”Show Standard Deviation Line?”)
wvf = ((highest(close, pd)-low)/(highest(close, pd)))*100
sDev = mult * stdev(wvf, bbl)
midLine = sma(wvf, bbl)
lowerBand = midLine – sDev
upperBand = midLine + sDev
rangeHigh = (highest(wvf, lb)) * ph
rangeLow = (lowest(wvf, lb)) * pl
col = wvf >= upperBand or wvf >= rangeHigh ? lime : gray
plot(hp and rangeHigh ? rangeHigh : na, title=”Range High Percentile”, style=line, linewidth=4, color=orange)
plot(hp and rangeLow ? rangeLow : na, title=”Range High Percentile”, style=line, linewidth=4, color=orange)
plot(wvf, title=”Williams Vix Fix”, style=histogram, linewidth = 4, color=col)
plot(sd and upperBand ? upperBand : na, title=”Upper Band”, style=line, linewidth = 3, color=aqua)01/06/2017 at 12:07 PM #2002801/06/2017 at 3:28 PM #20056
Here is the converted code. It has some lines that aren’t used in the code, so I commented them.123456789101112131415161718192021222324252627pd = 22 // "LookBack Period Standard Deviation High"bbl = 20 //"Bolinger Band Length"mult = 2.0 //"Bollinger Band Standard Devaition Up"lb = 50 //"Look Back Period Percentile High"ph = 0.85 //"Highest Percentile - 0.90=90%, 0.95=95%, 0.99=99%"//pl = 1.01 //"Lowest Percentile - 1.10=90%, 1.05=95%, 1.01=99%"mult = max(mult,1)mult = min(mult,5)wvf = ((highest[pd](close)-low)/(highest[pd](close)))*100sDev = mult * std[bbl](wvf)midLine = average[bbl](wvf)//lowerBand = midLine - sDevupperBand = midLine + sDevrangeHigh = (highest[lb](wvf)) * ph//rangeLow = (lowest[lb](wvf)) * plif (wvf >= upperBand or wvf >= rangeHigh) then //or (wvf <= lowerBand or wvf <= rangeLow) thencolor = 1elsecolor = -1endifRETURN wvf coloured by color as "Williams Vix Fix"
This version is only used to find bottoms in a bullish trend.01/06/2017 at 4:00 PM #2006104/05/2017 at 10:41 PM #3117306/06/2017 at 3:30 PM #3764901/28/2019 at 1:19 AM #89750
Could you please amend the above code by inserting a moving average[ variable n] within the indicator
I obviously can add and see any moving average but I would like to refer to its value when I use a CALL within a strategy I might post later on.
I tried to code it myself with the ‘Help” instructions but with no success.
Thanks01/28/2019 at 9:41 AM #89764
Here you go:123456789101112131415161718192021222324252627282930pd = 22 // "LookBack Period Standard Deviation High"bbl = 20 //"Bolinger Band Length"mult = 2.0 //"Bollinger Band Standard Devaition Up"lb = 50 //"Look Back Period Percentile High"ph = 0.85 //"Highest Percentile - 0.90=90%, 0.95=95%, 0.99=99%"n = 10//pl = 1.01 //"Lowest Percentile - 1.10=90%, 1.05=95%, 1.01=99%"mult = max(mult,1)mult = min(mult,5)wvf = ((highest[pd](close)-low)/(highest[pd](close)))*100sDev = mult * std[bbl](wvf)midLine = average[bbl](wvf)//lowerBand = midLine - sDevupperBand = midLine + sDevrangeHigh = (highest[lb](wvf)) * ph//rangeLow = (lowest[lb](wvf)) * plif (wvf >= upperBand or wvf >= rangeHigh) then //or (wvf <= lowerBand or wvf <= rangeLow) thencolor = 1elsecolor = -1endifave = average[n](wvf)RETURN wvf coloured by color as "Williams Vix Fix", ave style(line,1) as " WVF Average"
Change the value of n to your desired average period.
1 user thanked author for this post.01/28/2019 at 11:13 AM #8978110/15/2019 at 1:52 PM #110244
Thanks very much for this very useful indicator Nicolas and for the modification, Vonasi.
I had a couple of ideas:
Is it possible to code it to find tops and make it like the indicator (linked below) so it shows not just the IV rank but also the percentile (so it is scaled by 100%)?
“This indicator is meant to be a substitute for Implied VIX , which charts the implied of the SPX . The great thing about the VixFix is that it can be applied to any security, not just the SPX .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
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)?
Cheers!10/21/2019 at 6:31 PM #110750
If anyone can help contribute to the HV and IV Percentile/Rank indicator ideas please visit:
https://www.prorealcode.com/topic/a-better-implied-volatility-rank-and-percentile-indicator/10/21/2019 at 6:51 PM #110753
Bard – Technically you have double posted which is frowned upon within the forums as it leads to confusion and wasted time and is less likely to get you an answer and not more likely to.
I would suggest that anyone wishing to reply to you does so in the topic that you have provided a link to rather than here. Please do not double post again! 🙂10/22/2019 at 3:25 PM #11084810/22/2019 at 3:31 PM #110849
You did get a response. I responded here by accident before realising that I had replied to the wrong topic and then I had to move my post to the other topic. A lot of wasted time and effort on my side due to double posting.
If you don’t get an answer then it is most likely that the reason is because no one has an answer for you. Bumping the topic is unlikely to suddenly produce an answer.
1 user thanked author for this post.02/26/2020 at 1:36 PM #120566
In Nicholas attachment there is some bars on the histogram which is green, showing the market bottoms. However when I apply the indicator to some of my charts I don´t get a single green bar on the histogram.
Does anyone have a solution for this?