Reputation: 115
Suppose I have a pinescript series current
that looks like this;
current = [1 0 0 1 0 0 1 0 0 1]
I want to shift this series backward by 1. The shifted
variable will look like this;
shifted = [1 0 0 1 0 0 1 0 0 1 0]
The last sample of shifted
will always be 0
.
I am using pinescript v5
Upvotes: 3
Views: 403
Reputation: 2568
It depends on what you want to do with it next. If you just output a plot like this
plot(barstate.islast ? 0 : current, offset = -1)
Upvotes: 3