TradingPatternScanner icon indicating copy to clipboard operation
TradingPatternScanner copied to clipboard

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

Open ruthlessgoldie opened this issue 1 year ago • 0 comments
trafficstars

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`

ruthlessgoldie avatar Jun 09 '24 21:06 ruthlessgoldie