plot.histogram#
Emit a histogram bar at the current bar index.
SYNTAX#
function plot.histogram(label: string, value: number, opts?: { color?: string; negativeColor?: string; baseValue?: number }): voidARGUMENTS#
label(string) — Histogram series identifier. Same-label calls across bars form one histogram.value(number) — Bar height. Sign relative tobaseValuecontrols the direction.opts({ color?: string; negativeColor?: string; baseValue?: number }) — Defaults: color#888, negativeColor falls back tocolor, baseValue0.
RETURNS#
void
REMARKS#
Histogram and line slots with the same label do NOT collide — plot('x', ...) and plot.histogram('x', ...) are independent series.
EXAMPLE#
function onBar(i, ctx) {
const macd = ta.ema(closes, 12, i) - ta.ema(closes, 26, i);
const sig = ta.ema(macdHist, 9, i);
const hist = macd - sig;
plot.histogram('macd-hist', hist, { color: '#26a69a', negativeColor: '#ef5350' });
}SEE ALSO#
indicator.plot, indicator.plot.marker, indicator.plot.candle