Tried using max to find a previous period high but got an error saying I could not apply indexing

How do I find previous values of indicators?

Author