types.EntityHandle#
Handle returned from every entity.line/box/label/marker/arrow(...) call.
SYNTAX#
interface EntityHandle<P> { set(props: P): void; delete(): void; }ARGUMENTS#
set((props: P) => void) — Replace the stored props for this entity's key. Full replacement — no field-level merge; omitted optional fields fall back to their defaults.delete(() => void) — Remove the entity from the store. SubsequentRuntimeOutput.entitiessnapshots will not include it. Silently no-ops if already removed.
RETURNS#
Type definition.
REMARKS#
Handle identity is fixed at creation: set() always preserves the original kind and key, so a key smuggled into the props is ignored at runtime (and rejected at the type level). Calling a factory with a missing or empty key returns a no-op handle instead of throwing.
EXAMPLE#
function onBar(i, ctx) {
if (!ctx.isLast) return;
const level = 50000;
const h = entity.line({
key: 'level', x1: candles[0].time, y1: level,
x2: candles[i].time, y2: level, color: '#26a69a', style: 'dashed'
});
if (candles[i].close > level) h.delete(); // remove once price closes above
}SEE ALSO#
indicator.entity.line, indicator.entity.box, indicator.entity.label, indicator.entity.marker, indicator.entity.arrow