entity.marker#
Create or update a keyed marker at a data coordinate.
SYNTAX#
function entity.marker(props: { key: string; x: number; y: number; shape: 'circle' | 'square' | 'triangle' | 'triangle-down' | 'diamond' | 'cross' | 'x'; color: string; size?: number; forceOverlay?: boolean }): EntityHandleARGUMENTS#
props({ key, x, y, shape, color, size?, forceOverlay? }) —xis a unix-second timestamp;yis a price.shapeis one of seven glyphs.sizedefaults to a renderer-determined pixel size.
RETURNS#
EntityHandle — { set(props), delete() }.
REMARKS#
Use entity markers when you need the marker to survive across warmup runs (e.g. user-toggled signal pinning). Use plot.marker for ephemeral per-bar emissions.
EXAMPLE#
function onBar(i, ctx) {
if (i < 1) return;
if (candles[i].close > candles[i-1].close * 1.05) {
entity.marker({
key: 'spike-' + candles[i].time,
x: candles[i].time, y: candles[i].high,
shape: 'triangle', color: '#26a69a', size: 10
});
}
}SEE ALSO#
indicator.plot.marker, indicator.entity.label, types.MarkerShape, types.EntityHandle