Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=4
- study("Williams Vix Fix + Inverse [Alorse]", shorttitle="WVF + Inverse [Alorse]", overlay=false)
- // Bollinger Bands
- bbGroup = "Bollindger Bands"
- bbl = input(20, title="Length", group=bbGroup)
- mult = input(2.0, minval=1, maxval=5, title="Standard Deviation", group=bbGroup)
- // Williams Vix Fix
- wvfGroup = "Williams Vix Fix"
- pd = input(20, title="LookBack Period StdDev", tooltip="LookBack Period Standard Deviation", group=wvfGroup)
- lb = input(50, title="LookBack Period Percentile", group=wvfGroup)
- ph = input(85, title="Highest Percentile", group=wvfGroup) * 0.01
- pl = input(99, title="Lowest Percentile", group=wvfGroup) * 0.01
- wvf = ((highest(close, pd)-low)/(highest(close, pd)))*100
- sDev = mult * stdev(wvf, bbl)
- midLine = sma(wvf, bbl)
- upperBand = midLine + sDev
- rangeHigh = highest(wvf, lb) * ph
- colNormal = wvf >= upperBand or wvf >= rangeHigh ? color.lime : color.new(color.silver, 20)
- plot(wvf, title="Williams Vix Fix", style=plot.style_columns, color=colNormal)
- plot(upperBand, title="Normal StdDev line", style=plot.style_line, linewidth=1,color=color.blue)
- plot(0, title="Cero line", color=color.white, style=plot.style_line)
- wvfInv = ((high-lowest(close, pd))/lowest(close, pd))*100
- sDevInv = mult * stdev(wvfInv, bbl)
- midLineInv = sma(wvfInv, bbl)
- upperBandInv = midLineInv + sDevInv
- rangeHighInv = lowest(wvfInv, lb) * pl
- colInv = wvfInv <= upperBandInv or wvfInv <= rangeHighInv ? color.new(color.silver, 20) : color.orange
- plot(wvfInv*-1, title="Williams Vix Fix Inverted", style=plot.style_columns, color=colInv)
- plot(upperBandInv*-1, title="Inverted StdDev line", style=plot.style_line, linewidth=1,color=color.blue)
Advertisement
Add Comment
Please, Sign In to add comment