arkochhar / Technical-Indicators

Technical Indicators used in Stock Market Analysis
GNU General Public License v3.0
452 stars 185 forks source link

supertrend output is not correct this is not matching with leading portal calculations #5

Open mbmarx opened 6 years ago

mbmarx commented 6 years ago

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.

tryrt4ms commented 6 years ago

The problem seems to be while calculating EMA over TR. This gives a wrong ATR which in turn gives a wrong supertrend value

mbmarx commented 6 years ago

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 notifications@github.com 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

mbmarx commented 6 years ago

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.

Prchakr commented 5 years ago

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 commented 5 years ago

@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

Ashutoshsingh0004 commented 3 years ago

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]"

ganeshv02 commented 3 years ago

indicators.txt

Attached one works for me without issues and it matches Zerodha Kite chart.