Indicator request for Nic : CM_Williams_Vix_Fix

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #20017 quote
    Dimi.A
    Participant
    Average

    Nic,

    Could you please convert the VIX Fix for PRT please? Link.

    Here is the Pine Script code:

    study(“CM_Williams_Vix_Fix”, overlay=false)
    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)

    #20028 quote
    Dimi.A
    Participant
    Average

    There is also a version that picks tops and bottoms as well here:

    http://ninza.co/product/williams-vix-fix

    #20056 quote
    Nicolas
    Keymaster
    Master

    Here is the converted code. It has some lines that aren’t used in the code, so I commented them.

    pd = 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)))*100
    
    sDev = mult * std[bbl](wvf)
    midLine = average[bbl](wvf)
    //lowerBand = midLine - sDev
    upperBand = midLine + sDev
    
    rangeHigh = (highest[lb](wvf)) * ph
    //rangeLow = (lowest[lb](wvf)) * pl
    
    if (wvf >= upperBand or wvf >= rangeHigh) then //or (wvf <= lowerBand or wvf <= rangeLow) then
    color = 1
    else
    color = -1
    endif
    
    RETURN wvf coloured by color as "Williams Vix Fix"

    This version is only used to find bottoms in a bullish trend.

    Dimi.A, bolsatrilera, Despair, Vonasi and kj1988 thanked this post
    #20061 quote
    Dimi.A
    Participant
    Average

    That’s awesome Nic thank you mate!

    #31173 quote
    atxeel
    Participant
    Senior

    Thank you Nicolas!

    #37649 quote
    F3HP
    Participant
    Junior

    Merci Beaucoup Nicolas !

    #89750 quote
    achel
    Participant
    Average

    Thanks Nicolas

    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.

     

    Thanks

    #89764 quote
    Vonasi
    Moderator
    Master

    Here you go:

    pd = 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)))*100
     
    sDev = mult * std[bbl](wvf)
    midLine = average[bbl](wvf)
    //lowerBand = midLine - sDev
    upperBand = midLine + sDev
     
    rangeHigh = (highest[lb](wvf)) * ph
    //rangeLow = (lowest[lb](wvf)) * pl
     
    if (wvf >= upperBand or wvf >= rangeHigh) then //or (wvf <= lowerBand or wvf <= rangeLow) then
    color = 1
    else
    color = -1
    endif
    
    ave = 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.

    Nicolas thanked this post
    #89781 quote
    achel
    Participant
    Average

    Thanks a lot Vonasi

    #110244 quote
    Bard
    Participant
    Master

    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%)?

    https://www.tradingview.com/script/Z30icKNi-IV-Rank-IV-Percentile/

    “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)?

    Cheers!

    #110750 quote
    Bard
    Participant
    Master

    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/

    #110753 quote
    Vonasi
    Moderator
    Master

    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! 🙂

    #110848 quote
    Bard
    Participant
    Master

    That’s why I posted the link above after waiting 6 days without response here.

    #110849 quote
    Vonasi
    Moderator
    Master

    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.

    Bard thanked this post
    #120566 quote
    MajorBasse
    Participant
    Average

    Hello,

    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?

    Thank you

Viewing 15 posts - 1 through 15 (of 16 total)
  • You must be logged in to reply to this topic.

Indicator request for Nic : CM_Williams_Vix_Fix


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Dimi.A @dimi-a Participant
Summary

This topic contains 15 replies,
has 8 voices, and was last updated by Nicolas
5 years, 11 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 01/06/2017
Status: Active
Attachments: 3 files
Logo Logo
Loading...