3

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

FDL
  • 115
  • 8

1 Answers1

3

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)
AnyDozer
  • 2,236
  • 2
  • 5
  • 22