Documentation
Documentation / @elitechart/core / appendKagi
function appendKagi(
state,
raw,
opts): {
newSegments: readonly KagiSegment[];
state: KagiInternalState;
};
Defined in: series/kagi.ts:220
Append zero or one segment for one new source bar. Pure /
deterministic. Does NOT flush an in-flight leg — the batch helper
computeKagi does that at end of input.
Parameters
state
KagiInternalState | undefined
raw
Bar
opts
KagiOptions & {
fixedDtFallback?: number;
}
Returns
{
newSegments: readonly KagiSegment[];
state: KagiInternalState;
}
newSegments
readonly newSegments: readonly KagiSegment[];
state
readonly state: KagiInternalState;
Example
let state: KagiInternalState | undefined;
for (const b of liveBars) {
const r = appendKagi(state, b, { reversalPercent: 4 });
state = r.state;
if (r.newSegments.length > 0) render(r.newSegments);
}