Skip to content
EliteChart

suggestRenkoBrickSize

Documentation


Documentation / @elitechart/core / suggestRenkoBrickSize

code
function suggestRenkoBrickSize(bars, opts?): number;

Defined in: series/renko.ts:341

Suggest a sensible default brickSize for a series. The hard-coded 1.0 default makes Renko unusable on instruments whose price magnitude is far from 1 — e.g. BTCUSD ~$67k produces a degenerate one-pixel-per-dollar diagonal. The canonical approach is to derive brickSize from ATR(14) or as a percentage of the latest close.

Two methods supported:

  • 'atr' (default): mean(TR over last period) — the canonical ATR-Renko formulation. Period defaults to 14.
  • 'percent': latestClose * fraction. Fraction defaults to 0.005 (0.5%). Cheaper and works on series shorter than the ATR window.

Result is snapped to tickSize (with tickSize itself as the floor) so brickSize stays on the symbol's price grid.

Parameters

bars

readonly Bar[]

opts?

fraction?

number

method?

"atr" | "percent"

period?

number

tickSize?

number

Returns

number

Example

code
const brickSize = suggestRenkoBrickSize(bars, { tickSize: 0.01 });
chart.setRenkoOptions({ brickSize });