Real Meaning of REF

Can u plz explain meaning of REF [reference] in trade coding in detail . How it is used and plz give atleast 3 examples.

The REF function is used whenever you want to reference a value at any specific point in a vector.
In TradeScript references values backwards, i e from the end.

To get the most recent value in the Close vector we could write
Set A =Close

With using REF function we can write as
Set A =REF(Close,0)

To get the value as of one bar ago
Set A =REF(Close,1)

To get the value as of five bars ago
Set A =REF(Close,5)

1 Like

means REF works in reverse order…?