ta-lib-python
ta-lib-python copied to clipboard
Detecting Doji and Short line candle each time I run for every crypto tickers for present time. "False positive case"
`def search_pattern(symbol):
data = yfinance.download(symbol, period = "60d", interval = "1h" , progress = False )
#candlestick_patterns is python dictionary of pattern's function name used in Talib and full name
#[*candlestick_patterns] will return pattern's function name
for pattern in [*candlestick_patterns]:
# this will return store attribute of talib in a avribale( talib.BBANDS)
pattern_function = getattr(talib, pattern)
# it will search for pattern in data. will iterate over all pattern
result =pattern_function(data['Open'], data['High'], data['Low'], data['Close'])
#if pattern formed at last candle value will be non-zero. postive or negative
last = result.tail(1).values[0]
# if last value in result is positive
if last > 0:
print(f'{symbol} is Bullish {candlestick_patterns[pattern]} matched')
# if last value in result is negative
elif last < 0:
print(f'{symbol} is Bearish {candlestick_patterns[pattern]} matched')
# if value is zero
else:
pass
common_symbol = ['BTC-USD','BNB-USD','DOGE-USD','XRP-USD','CRV-USD','SYS-USD','NANO-USD','KSM-USD']
for symbol in common_symbol: search_pattern(symbol)`