0
votes

I want to shift "close" series into the past by X elements and then populate those X elements with data to simulate how %B, RSI, ema/sma, etc is affected in the future.

hist[5] = close

hist[4] = 5

hist[3] = 5.5

hist[2] = 5

hist[1] = 4.5

hist[0] = 6

I want to compute ema/sma/rsi etc on series "hist". How can I do this with PineScript?

1

1 Answers

0
votes

While you can refer to past values of series, you cannot modify them. Only the current series value can be assigned a value.

https://www.tradingview.com/pine-script-docs/en/v4/language/Operators.html#history-reference-operator