Skip to main content

Module renko

Module renko 

Source
Expand description

Renko bar construction (close-based, Drozda et al. 2024 Definition 1).

A Renko brick spans a fixed height ΔP (the “box”); a new brick is created only when the latest close leaves the current brick’s [min, max] band, so small moves are filtered out. This follows the formal definition in:

Drozda, Cavojsky, Sebes (2024), “On Suitability of Renko Charts for Algorithmic Trading”. Def. 1: the first brick R⁰ is anchored at the first close p₀; a close above p_max creates an up-brick [p_max, p_max + ΔP] and a close below p_min creates a down-brick [p_min − ΔP, p_min] (adjacent, non-retracing); several bricks may be created for one close. ΔP may vary per brick, so an ATR-derived box is the natural default.

A high/low-based variant (symmetric threshold |P(u) − P(τ)| = H) is used for pairs trading in Bogomolov (2013), “Pairs trading based on statistical variability of the spread process”, Quantitative Finance 13(9): 1411–1430; this module implements the close-based Drozda definition.

Two surfaces kept in parity (see the proptest):

Structs§

RenkoBrick
One Renko brick. direction is +1 (up) or -1 (down); open/close are the brick’s price boundaries box_size apart, in the direction of travel.
RenkoBuilder
Stateful close-based Renko builder (Drozda et al. 2024, Def. 1) with a fixed box size.

Functions§

renko_atr_batch
ATR-box Renko: box size is multiplier * atr, a single representative volatility value (Drozda et al. use ATR as the default box). Per Def. 1 the box may vary per brick; a fixed box per run keeps boundaries reproducible.
renko_batch
Batch Renko: fold RenkoBuilder over a close slice, returning all bricks.