Skip to content
EliteChart

appendRenkoBricks

Documentation


Documentation / @elitechart/core / appendRenkoBricks

code
function appendRenkoBricks(
   state, 
   raw, 
   opts): {
  newBricks: readonly Bar[];
  state: RenkoInternalState;
};

Defined in: series/renko.ts:158

Append zero or more bricks for one new source bar.

Returns the updated state plus the new bricks emitted. Pure / deterministic.

Parameters

state

RenkoInternalState | undefined

raw

Bar

opts

RenkoOptions & { fixedDtFallback?: number; }

Returns

code
{
  newBricks: readonly Bar[];
  state: RenkoInternalState;
}

newBricks

code
readonly newBricks: readonly Bar[];

state

code
readonly state: RenkoInternalState;

Example

code
import { appendRenkoBricks } from '@elitechart/core';
let state: RenkoInternalState | undefined;
for (const b of bars) {
  const r = appendRenkoBricks(state, b, { brickSize: 100 });
  state = r.state;
  newBricks.push(...r.newBricks);
}