rsi_value = rsi(close[1],lengthMiddle)
what does the close[1] means in tradingview pinescript and how it's different from close
rsi_value = rsi(close[1],lengthMiddle)
what does the close[1] means in tradingview pinescript and how it's different from close
It is the close value one bar ago.
In Pine, the close variable, or close[0] which is equivalent, holds the price at the close of the current bar. If your code is now executing on the third bar of the dataset, close will contain the price at the close of that bar, close[1] will contain the price at the close of the preceding bar (the second), and close[2], the first. close[3] will return na because no bar exists in that position, and thus its value is not available.
© 2022 - 2024 — McMap. All rights reserved.