Candles

API Reference

1. bar_index

Example:

pinescriptCopy code//@version=5
indicator("bar_index")
plot(bar_index)
plot(bar_index > 5000 ? close : 0)

Remarks: Note that bar_index has replaced n variable in version 4. Note that bar indexing starts from 0 on the first historical bar. Please note that using this variable/function can cause indicator repainting.

2. close

Remarks: Previous values may be accessed with square brackets operator [], e.g. close[1], close[2].

See Also: open, high, low, volume, time, hl2, hlc3, hlcc4, ohlc4

3. open

Remarks: Previous values may be accessed with square brackets operator [], e.g. open[1], open[2].

See Also: high, low, close, volume, time, hl2, hlc3, hlcc4, ohlc4

4. high

Remarks: Previous values may be accessed with square brackets operator [], e.g. high[1], high[2].

See Also: open, low, close, volume, time, hl2, hlc3, hlcc4, ohlc4

5. low

Remarks: Previous values may be accessed with square brackets operator [], e.g. low[1], low[2].

See Also: open, high, close, volume, time, hl2, hlc3, hlcc4, ohlc4 6. volume

Remarks: Previous values may be accessed with square brackets operator [], e.g. volume[1], volume[2].

See Also: open, high, low, close, time, hl2, hlc3, hlcc4, ohlc4

7. time

Remarks: Note that this variable returns the timestamp based on the time of the bar's open. Because of that, for overnight sessions (e.g. EURUSD, where Monday session starts on Sunday, 17:00) this variable can return time before the specified date of the trading day. For example, on EURUSD, dayofmonth(time) can be lower by 1 than the date of the trading day, because the bar for the current day actually opens one day prior.

8. hl2

See Also: open, high, low, close, volume, time, hlc3, hlcc4, ohlc4

9. hlc3

See Also: open, high, low, close, volume, time, hl2, hlcc4, ohlc4

10. hlcc4

See Also: open, high, low, close, volume, time, hl2, hlc3, ohlc4

11. ohlc4

See Also: open, high, low, close, volume, time, hl2, hlc3, hlcc4

Last updated