Williams Fractal

get_fractal(quotes, window_span=2, end_type = EndType.HIGH_LOW)

More overloaded interfaces

get_fractal(quotes, left_span, right_span, end_type)


name type notes
quotes Iterable[Quote] Iterable of the Quote class or its sub-class.
See here for usage with pandas.DataFrame
window_span int, default 2 Evaluation window span width (S). Must be at least 2.
end_type EndType Determines whether close or high/low are used to find end points. See EndType options below. Default is EndType.HIGH_LOW.

The total evaluation window size is 2×S+1, representing ±S from the evaluation date.

Historical quotes requirements

You must have at least 2×S+1 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 Chevron point identified from close price
HIGH_LOW Chevron point identified from high and low price (default)



👉 Repaint warning: this price pattern uses future bars and will never identify a fractal in the last S periods of quotes. Fractals are retroactively identified.


name type notes
date datetime Date
fractal_bear Decimal, Optional Value indicates a high point; otherwise None is returned.
fractal_bull Decimal, Optional Value indicates a low point; otherwise None is returned.


See Utilities and Helpers for more information.


from stock_indicators import indicators

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

# calculate Fractal
results = indicators.get_fractal(quotes, 5)

About Williams Fractal

Created by Larry Williams, Fractal is a retrospective price pattern that identifies a central high or low point. [Discuss] 💬