Kamalakannan J
Kamalakannan J

Reputation: 2998

PineScript: How to get only last day's OHLC instead of series of previous day OHLC?

I would like to get only last day's OHLC data on TradingView Pine Editor. If I use security() it gives the series of previous day data.

No matter, which timeframe the current chart is, I want the previous day's OHLC.

Upvotes: 0

Views: 1257

Answers (1)

PineCoders-LucF
PineCoders-LucF

Reputation: 8789

Use:

previousDayO = security(syminfo.tickerid, "D", open[1], lookahead = barmerge.lookahead_on)

Upvotes: 1

Related Questions