Technical-Indicators
Technical-Indicators copied to clipboard
supertrend output is not correct this is not matching with leading portal calculations
Checked the output for differrent parameter and it looks the accuracy is missing in the output. try to run your code and compare the result with tradingview or with chartink.com the outputs are not matching at all.
Need correction so that accurate output can be obtained.
The problem seems to be while calculating EMA over TR. This gives a wrong ATR which in turn gives a wrong supertrend value
Can you please correct it to get right superTrend value. If this is corrected your logic will be the best optimized logic.
On Mon, Apr 30, 2018 at 1:19 AM, tryrt4ms [email protected] wrote:
The problem seems to be while calculating EMA over TR. This gives a wrong ATR which in turn gives a wrong supertrend value
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/arkochhar/Technical-Indicators/issues/5#issuecomment-385276511, or mute the thread https://github.com/notifications/unsubscribe-auth/AgXQdV3VzJkzuuN-_oA4WnfAvR_lOs0aks5tthk4gaJpZM4SCnaf .
-- Regards, Marx Chidambara Babu M.B
ATR calculation is already supported by TALIB library and it is a built-in function. To get a very accurate calculation of the trend, you should use ATR from the standard library. Nowhere i have seen EMA period is given as input for ATR calculation.
Actually EMA module needs some corrections looks like. I have been trying this for a long time and i am getting the expected results for supertrend from this python code and it is matching with the Zerodha Kite connect portal. But EMA results are not matching with the Zerodha kite connect portal results. I have tried 20 period EMA, base as "Close" and results are not matching.
@Prchakr never mind code works absolutely fine Issue was with the parameter alpha which i set as false and got the wrong results. After setting it up true gave proper results
Hi I am getting an error, Can anyone please help me to resolve this?
Code---
for i in range(period, len(df)):
df['Supertrend_10_3'].iat[i]= df['F_UBand'].iat[i] if df['Supertrend_10_3'].iat[i - 1] == df['F_UBand'].iat[i - 1] and df[df['Close_Price']].iat[i] <= df['F_UBand'].iat[i] else
df['F_LBand'].iat[i] if df['Supertrend_10_3'].iat[i - 1] == df['F_UBand'].iat[i - 1] and df[df['Close_Price']].iat[i] > df['F_UBand'].iat[i] else
df['F_LBand'].iat[i] if df['Supertrend_10_3'].iat[i - 1] == df['F_LBand'].iat[i - 1] and df[df['Close_Price']].iat[i] >= df['F_LBand'].iat[i] else
df['F_UBand'].iat[i] if df['Supertrend_10_3'].iat[i - 1] == df['F_LBand'].iat[i - 1] and df[df['Close_Price']].iat[i] < df['F_LBand'].iat[i] else 0.00
Getting an Error--- raise KeyError(f"None of [{key}] are in the [{axis_name}]") KeyError: "None of [Float64Index([1423.95, 1422.35, 1433.55, 1423.45, 1407.2, 1401.1, 1399.5, 1383.35, 1320.85, 1284.2,\n ...\n 1727.65, 1748.95, 1723.0, 1763.9, 1761.65, 1761.75, 1775.95, 1765.75, 1788.05, 1819.3], dtype='float64', length=244)] are in the [columns]"