Macd data mismatch
-
Hi,
I'm able to retrive historical data but don't know why macd value is bit off, not matching angel macd value.
can you please guide why is that so ?def calculate_macd(df, short_window=12, long_window=26, signal_window=9):
df['EMA_12'] = df['close'].ewm(span=short_window, adjust=False).mean()
df['EMA_26'] = df['close'].ewm(span=long_window, adjust=False).mean()
df['MACD'] = df['EMA_12'] - df['EMA_26']
df['Signal_Line'] = df['MACD'].ewm(span=signal_window, adjust=False).mean()
return dfcandle_data = hist_data(["HDFCBANK", "HCLTECH", "AXISBANK", "ICICIBANK"], 10, "ONE_MINUTE", instrument_list)
Apply MACD calculation to each ticker's data
for ticker, df in candle_data.items():
candle_data[ticker] = calculate_macd(df) -
Hello @Sukant_algos
Please try to use TA-Lib - for technical indicators
There might be achance for difference value computed by different libraries
https://pypi.org/project/TA-Lib/Regards,
SmartAPI Team