Add %B indicator
This commit is contained in:
parent
f23c0e47c3
commit
d14066e3e0
19
%b.pine
Normal file
19
%b.pine
Normal file
@ -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)
|
Loading…
Reference in New Issue
Block a user