Login Page - Create Account

Support Board


Date/Time: Wed, 12 Feb 2025 08:53:29 +0000



Post From: How to look back x number of bars

[2020-10-12 01:51:28]
User561641 - Posts: 4
I've done extensive searching and can't seem to figure out the right syntax to do something like this:

Let's say I have 2 indicator studies on a chart and both always produce positive numbers.
ID1.SG1
ID2.SG1
Now if I want to get the value of say ID1.SG1 from three bars back, I'd reference it like this: ID1.SG1[-3].
But, if I want to get the value of ID1.SG1 from the number of bars back based on the current value of ID2.SG1 I'd logically do it like this: ID1.SG1[-ID2.SG1]. This produces a syntax error. How do I achieve this?