Janar Rumm
Janar Rumm

Reputation: 1

Pine tradingview get plot value with offset

How to get the value of an ema with a offset applied (id want the offset) to be in the past aka -5 bars for example

plot(ema(close, 15), offset=-5)

Upvotes: 0

Views: 940

Answers (2)

Bhavik Kalal
Bhavik Kalal

Reputation: 65

you can just try this

LIFE32 = ta.ema(close, 3)
    
    plotshape(LIFE32[2] < close, "LIFE UP", shape.triangleup, location.belowbar, color=color.green)

Upvotes: 0

Starr Lucky
Starr Lucky

Reputation: 1961

It is possible to refer to past values of time series using the [] history-referencing operator

//@version=5
indicator("My Script")


ema = ta.ema(close, 15)
plot(ema15[5], color = color.red)

https://www.tradingview.com/pine-script-docs/en/v5/language/Operators.html#history-referencing-operator

Upvotes: 1

Related Questions