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

I want to discuss something.Why did not you use swing level to fing patterns. #16

Open
ruthlessgoldie opened this issue Jun 9, 2024 · 0 comments

Comments

@ruthlessgoldie
Copy link

Your code is well-written and works nicely. However, I think it has a significant shortcoming. I couldn't add the pivot levels to your code because I don't know how to do it. That's why I decided to write to you. Also, I think the window scanning is not very reliable. I believe it should be dynamic and all swings should be analyzed in relation to each other.
Your code signals in circles
df = yf.download('BTC-USD', period='3mo',interval='1d') used below graph.
Adsız

`# Define your swing function
def swing(df, i):
if i == 0 or i == len(df) - 1:
return None # Return None for the first and last indices

is_swing_low = df['Low'].iloc[i] < df['Low'].iloc[i - 1] and df['Low'].iloc[i] < df['Low'].iloc[i + 1]
is_swing_high = df['High'].iloc[i] > df['High'].iloc[i - 1] and df['High'].iloc[i] > df['High'].iloc[i + 1]

if is_swing_low:
    return 2  # Low swing
elif is_swing_high:
    return 1  # High swing
else:
    return None`
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