Skip to content

patterns

patterns

Modules:

Name Description
utils

Functions:

Name Description
doji

Doji Pattern

dojistar

Dojistar Pattern

hammer

Hammer Pattern

inverted_hammer

Inverted Hammer Pattern

doji

doji(
    candles: List[Candle],
    lookback: Optional[int] = None,
    index: Optional[int] = None,
) -> bool

Doji Pattern A candle body is Doji when it's shorter than 10% of the average of the n(10) previous candles' high-low range.

Source: https://github.com/TA-Lib/ta-lib

Parameters:

Name Type Description Default
candles Optional[int]

Candles to use to find Doji Candle

required
lookback Optional[int]

Lookback allows detecting an Doji candles N back. Defaults to None.

None
index Optional[int]

Index of Candle to check. Defaults to None/Latest.

None

Returns:

Name Type Description
bool bool

True if given Candle/Candle range is Doji

Source code in hexital/analysis/patterns.py
def doji(
    candles: List[Candle],
    lookback: Optional[int] = None,
    index: Optional[int] = None,
) -> bool:
    """Doji Pattern
    A candle body is Doji when it's shorter than 10% of the average of the
    n(10) previous candles' high-low range.

    Source: https://github.com/TA-Lib/ta-lib

    Args:
        candles (Optional[int]): Candles to use to find Doji Candle
        lookback (Optional[int]): Lookback allows detecting an Doji candles N back. Defaults to None.
        index (Optional[int]): Index of Candle to check. Defaults to None/Latest.

    Returns:
        bool: True if given Candle/Candle range is Doji
    """
    index_ = absindex(index, len(candles))

    if lookback is None:
        return _doji(candles, index_)

    return any(_doji(candles, i) for i in range(len(candles) - lookback, len(candles)))

dojistar

dojistar(
    candles: List[Candle],
    lookback: Optional[int] = None,
    index: Optional[int] = None,
) -> bool

Dojistar Pattern A Dojistar is either bearish or bullish, and is detected when we have a larger then average candle followed by a candle candle shorter than 10% of the average of the n(10) of the average and then the candle gaps up or down. A trend is required to find which direction.

Source: https://github.com/TA-Lib/ta-lib Args: candles (Optional[int]): Candles to use to find Dojistar Candle lookback (Optional[int]): Lookback allows detecting an Dojistar candles N back. Defaults to None. index (Optional[int]): Index of Candle to check. Defaults to None/Latest.

Returns:

Name Type Description
bool bool

True if given Candle/Candle range is Doji star

Source code in hexital/analysis/patterns.py
def dojistar(
    candles: List[Candle],
    lookback: Optional[int] = None,
    index: Optional[int] = None,
) -> bool:
    """Dojistar Pattern
    A Dojistar is either bearish or bullish, and is detected when we have a larger then average
    candle followed by a candle candle shorter than 10% of the average of the
    n(10) of the average and then the candle gaps up or down.
    A trend is required to find which direction.

    Source: https://github.com/TA-Lib/ta-lib
    Args:
        candles (Optional[int]): Candles to use to find Dojistar Candle
        lookback (Optional[int]): Lookback allows detecting an Dojistar candles N back. Defaults to None.
        index (Optional[int]): Index of Candle to check. Defaults to None/Latest.

    Returns:
        bool: True if given Candle/Candle range is Doji star
    """
    index_ = absindex(index, len(candles))

    if lookback is None:
        return _dojistar(candles, index_)

    return any(_dojistar(candles, i) for i in range(len(candles) - lookback, len(candles)))

hammer

hammer(
    candles: List[Candle],
    lookback: Optional[int] = None,
    index: Optional[int] = None,
) -> bool | int

Hammer Pattern A Hammer is detected when the Candle's open and close values are considered shorter than 10% of the average of the n(10) candles. However the low is larger than the average.

Source: https://github.com/TA-Lib/ta-lib Args: candles (Optional[int]): Candles to use to find Hammer Candle lookback (Optional[int]): Lookback allows detecting an Hammer candles N back. Defaults to None. index (Optional[int]): Index of Candle to check. Defaults to None/Latest.

Returns:

Name Type Description
bool bool | int

True if given Candle/Candle range is Hammer

Source code in hexital/analysis/patterns.py
def hammer(
    candles: List[Candle],
    lookback: Optional[int] = None,
    index: Optional[int] = None,
) -> bool | int:
    """Hammer Pattern
    A Hammer is detected when the Candle's open and close values are considered shorter
    than 10% of the average of the n(10) candles. However the low is larger than the average.

    Source: https://github.com/TA-Lib/ta-lib
    Args:
        candles (Optional[int]): Candles to use to find Hammer Candle
        lookback (Optional[int]): Lookback allows detecting an Hammer candles N back. Defaults to None.
        index (Optional[int]): Index of Candle to check. Defaults to None/Latest.

    Returns:
        bool: True if given Candle/Candle range is Hammer
    """
    index_ = absindex(index, len(candles))

    if lookback is None:
        return _hammer(candles, index_)

    return any(_hammer(candles, i) for i in range(len(candles) - lookback, len(candles)))

inverted_hammer

inverted_hammer(
    candles: List[Candle],
    lookback: Optional[int] = None,
    index: Optional[int] = None,
) -> bool | int

Inverted Hammer Pattern An Inverted Hammer is detected when the Candle's open and close values are considered shorter than 10% of the average of the n(10) candles. However the high is larger than the average.

Source: https://github.com/TA-Lib/ta-lib Args: candles (Optional[int]): Candles to use to find Inverted Hammer Candle lookback (Optional[int]): Lookback allows detecting an InvertedHammer candles N back. Defaults to None. index (Optional[int]): Index of Candle to check. Defaults to None/Latest.

Returns:

Name Type Description
bool bool | int

True if given Candle/Candle range is Inverted Hammer

Source code in hexital/analysis/patterns.py
def inverted_hammer(
    candles: List[Candle],
    lookback: Optional[int] = None,
    index: Optional[int] = None,
) -> bool | int:
    """Inverted Hammer Pattern
    An Inverted Hammer is detected when the Candle's open and close values are considered shorter
    than 10% of the average of the n(10) candles. However the high is larger than the average.

    Source: https://github.com/TA-Lib/ta-lib
    Args:
        candles (Optional[int]): Candles to use to find Inverted Hammer Candle
        lookback (Optional[int]): Lookback allows detecting an InvertedHammer candles N back. Defaults to None.
        index (Optional[int]): Index of Candle to check. Defaults to None/Latest.

    Returns:
        bool: True if given Candle/Candle range is Inverted Hammer
    """
    index_ = absindex(index, len(candles))

    if lookback is None:
        return _inverted_hammer(candles, index_)

    return any(_inverted_hammer(candles, i) for i in range(len(candles) - lookback, len(candles)))