Data Sources
OHLCV Candles
Candle data with price, volume, and trade counts.
data.OHLCV exposes the chart or subscribed candle stream.
data.OHLCV is single-exchange only. Aggregated exchange strings are not supported for OHLCV subscriptions.
const candles = subscribe(data.OHLCV)Functions
candles.open(offset?) -> number
candles.high(offset?) -> number
candles.low(offset?) -> number
candles.close(offset?) -> number
candles.volume(offset?) -> number
candles.buyVolume(offset?) -> number
candles.sellVolume(offset?) -> number
candles.buyCount(offset?) -> number
candles.sellCount(offset?) -> number
candles.unix(offset?) -> numberoffset?: optional bar offset on the OHLCV subscription clock
Example
//@version=2
indicator("OHLCV Example", false)
const candles = subscribe(data.OHLCV)
function onBar(index) {
const delta = candles.buyVolume() - candles.sellVolume()
plot("Close", candles.close(), { color: color.white })
plotHistogram("Volume Delta", delta, {
color: delta >= 0 ? color.teal : color.orange
})
}