Skip to content

Error Identified in detect_multiple_tops_bottoms #10

@CircuitCoder-ngh

Description

@CircuitCoder-ngh

https://github.com/keithorange/PatternPy/blob/2b1f29b17986acafffeb32c83e772417d540c100/tradingpatterns/tradingpatterns.py#L31C5-L34C5

The following logic is problematic because close_roll_max cannot/will not ever be less than the prior close (which is retrieved with df['Close'].shift(1)). I am operating under the assumption though that the underlying df is in chronological order (which is not always the case depending on the API you use for historical data).

# Create a boolean mask for multiple top pattern mask_top = (df['high_roll_max'] >= df['High'].shift(1)) & (**df['close_roll_max'] < df['Close'].shift(1)**) # Create a boolean mask for multiple bottom pattern mask_bottom = (df['low_roll_min'] <= df['Low'].shift(1)) & (**df['close_roll_min'] > df['Close'].shift(1)**)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions