diff --git a/%b.pine b/%b.pine new file mode 100644 index 0000000..ca231cc --- /dev/null +++ b/%b.pine @@ -0,0 +1,19 @@ +// Credit to @kerberos007. +//@version=5 +indicator("%B", shorttitle="%B", overlay=false) + +moving_average = input.int(20, minval=1, title="Moving Average") +std_dev = input(2.0, title="Standard Deviations") +symbol = input("VIX", title="Symbol") + +current_close = request.security(symbol, timeframe.period, close) + +[basis, upper_band, lower_band] = ta.bb(current_close, moving_average, std_dev) + +percentB = (current_close - lower_band) / (upper_band - lower_band) + +plot(percentB, title="%B", color=color.yellow) + +hline(0, "Lower Band", color=color.red, linestyle=hline.style_solid) +hline(0.5, "Middle Band", color=color.gray, linestyle=hline.style_solid) +hline(1, "Upper Band", color=color.lime, linestyle=hline.style_solid) \ No newline at end of file