@rekurt/openkline - v0.2.0
    Preparing search index...

    Function toRenko

    • Renko "bricks" are time-agnostic blocks built purely from price movement. A new brick appears only after price has moved at least brickSize from the previous brick's close.

      The output conforms to the Candle shape so it can feed straight into OHLCVChart, but:

      • t is the timestamp of the SOURCE candle that triggered the brick
      • o is the previous brick's close
      • c = o ± brickSize (up or down)
      • h/l equal the extremes of o and c
      • v is 0 (bricks don't correspond to a single source bar)

      This is the classic "one brick per move" variant — gaps larger than brickSize emit multiple stacked bricks in the same direction.

      Usage:

      const bricks = toRenko(rawCandles, 50); chart.setData(bricks);

      Reversal behavior: to flip direction, price must move 2 * brickSize from the last brick's close (one brick to cancel the current run, one brick to start the new run). This matches TradingView's default.

      Parameters

      • candles: readonly Candle[]
      • brickSize: number

      Returns Candle[]