OPEN-SOURCE SCRIPT
CM_Williams_Vix_Fix Market Top Winit

//version=5
indicator('CM_Williams_Vix_Fix Market Top', overlay=false)
// Inputs
pd = input(22, title='LookBack Period Standard Deviation High')
bbl = input(20, title='Bollinger Band Length')
mult = input.float(2.0, minval=1, maxval=5, title='Bollinger Band Standard Deviation Up')
lb = input(50, title='Look Back Period Percentile High')
ph = input(0.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?')
// Core Calculation (Inverted for Market Top)
wvf_top = (close - ta.lowest(close, pd)) / ta.lowest(close, pd) * 100 // Detect extreme highs
sDev = mult * ta.stdev(wvf_top, bbl)
midLine = ta.sma(wvf_top, bbl)
lowerBand = midLine - sDev
upperBand = midLine + sDev
rangeHigh = ta.highest(wvf_top, lb) * ph
rangeLow = ta.lowest(wvf_top, lb) * pl
// Color logic: highlight extreme highs
col = wvf_top >= upperBand or wvf_top >= rangeHigh ? color.red : color.gray
// Plots
plot(wvf_top, title='Williams Vix Fix Market Top', style=plot.style_histogram, linewidth=3, color=col)
// Optional plots
plot(hp ? rangeHigh : na, title='Range High Percentile', style=plot.style_line, linewidth=2, color=color.new(color.orange, 0))
plot(hp ? rangeLow : na, title='Range Low Percentile', style=plot.style_line, linewidth=2, color=color.new(color.orange, 0))
plot(sd ? upperBand : na, title='Upper Band', style=plot.style_line, linewidth=2, color=color.new(color.aqua, 0))
plot(sd ? lowerBand : na, title='Lower Band', style=plot.style_line, linewidth=2, color=color.new(color.aqua, 0))
indicator('CM_Williams_Vix_Fix Market Top', overlay=false)
// Inputs
pd = input(22, title='LookBack Period Standard Deviation High')
bbl = input(20, title='Bollinger Band Length')
mult = input.float(2.0, minval=1, maxval=5, title='Bollinger Band Standard Deviation Up')
lb = input(50, title='Look Back Period Percentile High')
ph = input(0.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?')
// Core Calculation (Inverted for Market Top)
wvf_top = (close - ta.lowest(close, pd)) / ta.lowest(close, pd) * 100 // Detect extreme highs
sDev = mult * ta.stdev(wvf_top, bbl)
midLine = ta.sma(wvf_top, bbl)
lowerBand = midLine - sDev
upperBand = midLine + sDev
rangeHigh = ta.highest(wvf_top, lb) * ph
rangeLow = ta.lowest(wvf_top, lb) * pl
// Color logic: highlight extreme highs
col = wvf_top >= upperBand or wvf_top >= rangeHigh ? color.red : color.gray
// Plots
plot(wvf_top, title='Williams Vix Fix Market Top', style=plot.style_histogram, linewidth=3, color=col)
// Optional plots
plot(hp ? rangeHigh : na, title='Range High Percentile', style=plot.style_line, linewidth=2, color=color.new(color.orange, 0))
plot(hp ? rangeLow : na, title='Range Low Percentile', style=plot.style_line, linewidth=2, color=color.new(color.orange, 0))
plot(sd ? upperBand : na, title='Upper Band', style=plot.style_line, linewidth=2, color=color.new(color.aqua, 0))
plot(sd ? lowerBand : na, title='Lower Band', style=plot.style_line, linewidth=2, color=color.new(color.aqua, 0))
Script open-source
Dans l'esprit de TradingView, le créateur de ce script l'a rendu open-source, afin que les traders puissent examiner et vérifier sa fonctionnalité. Bravo à l'auteur! Vous pouvez l'utiliser gratuitement, mais n'oubliez pas que la republication du code est soumise à nos Règles.
Clause de non-responsabilité
Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.
Script open-source
Dans l'esprit de TradingView, le créateur de ce script l'a rendu open-source, afin que les traders puissent examiner et vérifier sa fonctionnalité. Bravo à l'auteur! Vous pouvez l'utiliser gratuitement, mais n'oubliez pas que la republication du code est soumise à nos Règles.
Clause de non-responsabilité
Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.