Closed Jacks349 closed 4 years ago
Hello @Jacks349,
Thanks for using Pandas TA!
Now i know the question might be naive, but is there a difference on how the indicator is calculated on this library and Tradingview? Or am i just missing something or doing something wrong?
Trading View does not have a builtin Super Trend, but there are many user created Super Trend variations. Everget, like many others, typically enhance a standard calculation of an indicator for various reasons and it is very easy to do so with Pinescript. So there is likely a difference in the Everget's Super Trend on Trading View versus Pandas TA.
To reduce complexity and ensure accuracy, I try and implement the standard implementation before considering external variations. The purest form Super Trend, meaning no additional features in their calculation, I have found to implement for Pandas TA is described here.
Also to help with charting in Python, I have slightly modified Pandas TA to return a DataFrame with four columns: SUPERT (trend), SUPERTd (direction), SUPERTl (long), SUPERTs (short) columns. The first SUPERT is Super Trend of course, the second SUPERTd returns the direction 1 (for long) -1 (for short), SUPERTl returns only the long portions of SUPERT and SUPERTs returns only the short portions of SUPERT. Visually, the first chart below is SUPERTd (blue area). The second chart is SUPERT (blue). Finally, the third chart is both SUPERTl (green) and SUPERTs (red).
You can find more information about a Pandas TA indicator by using help()
import pandas_ta as ta
help(ta.supertrend)
First of all, thank you for open sourcing this library, it's incredibly easy to use and it has indicators/studies that none of the other libraries i've checked have.
If you find this library useful, please add a :star:.
Hope this helps!
Thanks, KJ
This was incredibly helpful! Thank you a lot! Everything is clear now! Added my star, keep up the awesome work!
Thank you @Jacks349. I appreciate it!
Good luck with your trading and investing.
First of all, thank you for open sourcing this library, it's incredibly easy to use and it has indicators/studies that none of the other libraries i've checked have.
I was trying to run a backtest on the Supertrend indicator, and since i noticed a substantial difference from how it is implemented on Tradingview, i wanted to investigate a little more on this. I tried the following:
st = ta.supertrend(df['high'], df['low'], df['close'], 10, 4.0)
Where
df
is my OHLC dataframe. This got me the following result:While, with the same data (retrieved from here ) Tradingview will look like this (i'm using this implementation): https://www.tradingview.com/x/Xi38z7Hn/
Now i know the question might be naive, but is there a difference on how the indicator is calculated on this library and Tradingview? Or am i just missing something or doing something wrong?
Again, thank you for making this awesome library available to everyone. Keep up the good work!