Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error Identified in detect_multiple_tops_bottoms #10

Open
CircuitCoder-ngh opened this issue Oct 25, 2024 · 0 comments
Open

Error Identified in detect_multiple_tops_bottoms #10

CircuitCoder-ngh opened this issue Oct 25, 2024 · 0 comments

Comments

@CircuitCoder-ngh
Copy link

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)**)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant