Lets suppose we have series of numbers. It contains some values [..., 3, 6, 4, 7]
. I would like to get maximum of 100 last elements.
I tried max(series[100])
, but it looks like series[100] operator returns sub-series discarding last 100 elements.
That's correct. In Pine-script everything become a series, even a constant once you are using it, since all functions return a
series
. This means, that you can always put (non-series) constants in, but you can never get them out.I think what you want is: