I don't need a whole array of this expression, just its very recent (current) value. How to modify its code?
UpperBollinger = ta.sma(close, 20) + 2 * ta.stdev(close, 20)
(Of course, I can use it to get the same for the lower band.)
I don't need a whole array of this expression, just its very recent (current) value. How to modify its code?
UpperBollinger = ta.sma(close, 20) + 2 * ta.stdev(close, 20)
(Of course, I can use it to get the same for the lower band.)
You cannot do that.
Once a series
always a series
. You want to have the "last" value but on the next bar you need the last value again, and on the next bar again. Isn't your requirement creates a series?
As explained in the type system, using certain built-in functions and variables yield a result of series
. close
, ta.sma()
, ta.stdev
all return series
. So your end result will also be a series
.
Built-in variables such as open, close, high, time or volume are of “series” form, as would be the result of expressions calculated using them. Functions such as barssince() or crossover() yield a result of “series” form because it varies bar to bar, as does that of the [] history-referencing operator used to access past values of a time series.