pandas-ta: PSAR indicator - Incorrect value
Which version are you running? The lastest version is on Github. Pip is for major releases.
import pandas_ta as ta
print(ta.version)
0.2.28b0
Upgrade.
$ pip install -U git+https://github.com/twopirllc/pandas-ta
Describe the bug A clear and concise description of what the bug is. The value of PSAR seems incorrect (as compared to TradingView).
– Pandas_ta for 2020-12-31 PSARs_0.02_0.2 = 377.265728 TradingView for 2020-12-31 PSAR = 363.67
To Reproduce Provide sample code.
from pandas_datareader import data
from IPython.display import display, HTML
import pandas as pd
import datetime
import pandas_ta as ta
start = datetime.datetime(2020, 1, 1)
end = datetime.datetime.now()
ticker = "SPY"
df = data.DataReader(ticker,
start=start,
end=end,
data_source='yahoo')
df.ta.psar(append=True)
display(HTML(df.sort_index(ascending=False).to_html()))
Expected behavior A clear and concise description of what you expected to happen. The value of PSAR should be as close as possible to TradingView Screenshots If applicable, add screenshots to help explain your problem.
Additional context Add any other context about the problem here.
Thanks for using Pandas TA!
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 23 (11 by maintainers)
Commits related to this issue
- BUG #180 psar with dm init — committed to AbyssAlora/pandas-ta by deleted user 3 years ago
Hi @twopirllc, I’ve made some changes as well as I’ve done some correlation tests, but I have no idea if it’s enough.
Code:
Should be reviewd.
Tests:
Results 1m data:
Results 4h data:
Hope that’s ok and helpful as well.
Kind regards, AA
Hello, I’ve tried reproduce TV psar from chart today, but i put there no more than half of hour. I wrote code in different language but here is python version (hope that it’s ok). This code produced similar results to TV on some live tests, but I have no time to test it properly. Maybe it’ll help, but I think that definition of psar is slightly different.
Let me know if there are some incorrections and I’ll take a look.
Best regards, AA
https://www.tradinformed.com/calculate-psar-indicator-revised/