Mar-19-2022, 10:10 AM
(This post was last modified: Mar-19-2022, 10:10 AM by egemynet.
Edit Reason: Added code tags
)
Why is the result wrong in the if structure below, it gives 1 every time, but it should be 2 in my checks (python 3.1)
bars = exchange.fetch_ohlcv(symbol, timeframe=zamanAraligi, since=None, limit=500) df = pd.DataFrame(bars, columns=["timestamp", "open", "high", "low", "close", "volume"]) #ema control e8 = ta.ma("ema", df.close, length=8) e13 = ta.ma('ema', df.close, length=13) e21 = ta.ma('ema', df.close, length=21) e55 = ta.ma('ema', df.close, length=55) #ema rating sum = 0 if any(e8 > e13): sum = 1 elif any(e8 < e13): sum = 0 elif any(e13 > e21): sum = 1 elif any(e13 < e21): sum = 0 elif any(e21 > e55): sum = 1 else: sum = 0 print(e8, e13, e21, e55) print(sum)