Renko Chart

get_renko(quotes, brick_size, end_type=EndType.CLOSE)

Parameters

name type notes
quotes Iterable[Quote] Iterable of the Quote class or its sub-class.
β€’ See here for usage with pandas.DataFrame
brick_size float Brick size. Must be greater than 0.
end_type EndType, default EndType.CLOSE See EndType options below.

Historical quotes requirements

You must have at least two periods of quotes to cover the warmup periods; however, more is typically provided since this is a chartable candlestick pattern.

quotes is an Iterable[Quote] collection of historical price quotes. It should have a consistent frequency (day, hour, minute, etc). See the Guide for more information.

EndType options

from stock_indicators.indicators.common.enums import EndType
type description
CLOSE Brick change threshold measured from close price (default)
HIGH_LOW Brick change threshold measured from high and low price

Return

RenkoResults[RenkoResult]

🚩 Warning: Unlike most indicators in this library, this indicator DOES NOT return the same number of elements as there are in the historical quotes. Renko bricks are added to the results once the brickSize change is achieved. For example, if it takes 3 days for a $2.50 price change to occur an entry is made on the third day while the first two are skipped. If a period change occurs at multiples of brickSize, multiple bricks are drawn with the same Date. See online documentation for more information.

RenkoResult

Each result record represents one Renko brick.

name type notes
date datetime Formation date of brick(s)
open Decimal Brick open price
high Decimal Highest high during elapsed quotes periods
low Decimal Lowest low during elapsed quotes periods
close Decimal Brick close price
volume Decimal Sum of Volume over elapsed quotes periods
is_up bool Direction of brick (true=up,false=down)

🚩 Warning: When multiple bricks are drawn from a single quote period, the extra information about High and Low wicks and Volume is potentially confusing to interpret. High and Low wicks will be the same across the multiple bricks; and Volume is portioning evenly across the number of bricks. For example, if within one quote period 3 bricks are drawn, the Volume for each brick will be (sum of quotes Volume since last brick) / 3.

Utilities

See Utilities and Helpers for more information.

Example

from stock_indicators import indicators
from stock_indicators import EndType     # Short path, version >= 0.8.1

# This method is NOT a part of the library.
quotes = get_historical_quotes("SPY")

# Calculate
results = indicators.get_renko(quotes, 2.5, EndType.CLOSE);

ATR Variant

get_renko_atr(quotes, atr_periods, end_type=EndType.CLOSE)

Parameters for ATR

name type notes
atr_periods int Number of lookback periods (A) for ATR evaluation. Must be greater than 0.
end_type EndType, default EndType.CLOSE See EndType options.

Historical quotes requirements for ATR

You must have at least A+100 periods of quotes.

quotes is an Iterable[Quote] collection of historical price quotes. It should have a consistent frequency (day, hour, minute, etc). See the Guide for more information.

Return for ATR

RenkoResults[RenkoResult]

πŸ‘‰ Repaint warning: When using the GetRenkoAtr() variant, the last Average True Range (ATR) value is used to set brickSize. Since the ATR changes over time, historical bricks will be repainted as new periods are added or updated in quotes.

Example for ATR variant

from stock_indicators import indicators

# This method is NOT a part of the library.
quotes = get_historical_quotes("SPY")

# Calculate
results = indicators.get_renko_atr(quotes, atr_periods);

About Renko Chart

The Renko Chart is a Japanese price transformed candlestick pattern that uses β€œbricks” to show a defined increment of change over a non-linear time series. Transitions can use either close or high/low price values. An ATR variant is also provided where brick size is determined by Average True Range values. [Discuss] πŸ’¬

image

Sources