Skip to content

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

@ruthlessgoldie

Description

@ruthlessgoldie

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`

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