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]
- This method returns a time series of all available indicator values for the
quotes
provided. RenkoResults
is just a list ofRenkoResult
.- It does not return a single incremental indicator value.
π© 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 ofbrickSize
, multiple bricks are drawn with the sameDate
. 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 aboutHigh
andLow
wicks andVolume
is potentially confusing to interpret.High
andLow
wicks will be the same across the multiple bricks; andVolume
is portioning evenly across the number of bricks. For example, if within onequote
period 3 bricks are drawn, theVolume
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]
- This method returns a time series of all available indicator values for the
quotes
provided. RenkoResults
is just a list ofRenkoResult
.- It does not return a single incremental indicator value.
π© 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 ofbrickSize
, multiple bricks are drawn with the sameDate
. See online documentation for more information.
π Repaint warning: When using the
GetRenkoAtr()
variant, the last Average True Range (ATR) value is used to setbrickSize
. Since the ATR changes over time, historical bricks will be repainted as new periods are added or updated inquotes
.
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] π¬