-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Different SuperTrend results #867
Labels
bug
Something isn't working
duplicate
This issue or pull request already exists
help wanted
Extra attention is needed
Comments
twopirllc
added
duplicate
This issue or pull request already exists
help wanted
Extra attention is needed
labels
Dec 24, 2024
Hello @sussyboiiii Thanks for the info and suggestions. 👍🏼 Most beneficial is the actual exported TV supertrend values included in the INDEX_ETHUSD.csv for a more exact comparison (instead of relying on charts) if you are able to. 😎 Happy Holidays |
I used the following code and it gives me 100% same results as shown in TradingView. import pandas_ta as pta
def calculate_supertrend(df, supertrend_length, supertrend_multiplier, type):
st_values = f'{supertrend_length}_{supertrend_multiplier}'
supertrend = pta.supertrend(df['ha_high'], df['ha_low'], df['ha_close'], length=supertrend_length,
multiplier=supertrend_multiplier)
df[f'ST_l_{type}'] = supertrend[f'SUPERTl_{st_values}']
df[f'ST_s_{type}'] = supertrend[f'SUPERTs_{st_values}']
df[f'ST_{type}'] = supertrend[f'SUPERT_{st_values}']
df[f'ST_d_{type}'] = supertrend[f'SUPERTd_{st_values}']
return df |
Which |
@twopirllc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
Something isn't working
duplicate
This issue or pull request already exists
help wanted
Extra attention is needed
Which version are you running? The lastest version is on Github. Pip is for major releases.
0.3.14b0
Do you have TA Lib also installed in your environment?
Yes
Have you tried the development version? Did it resolve the issue?
No
Describe the bug
When using a different source for the supertrend the results are different from the TradingView counterpart. Also it can happen that the close price of a candle is above the upperband but the signal comes the day later.
To Reproduce
Expected behavior
I would have expected it to behave the same way as the TradingView SuperTrend when changing the source and the atr to standard deviation.
Screenshots
I have two screenshots which show the Python and Pine SuperTrend results on INDEX:ETHUSD with the same settings.
Additional context
Here is the equivalent Pine code:
Here the INDEX:ETHUSD data for Python.
INDEX_ETHUSD.csv
The text was updated successfully, but these errors were encountered: