Psar loop starting at wrong index 1
See original GitHub issuePandas ta version
0.3.14b0
Describe the bug When reviewing the code of psar (https://github.com/twopirllc/pandas-ta/blob/main/pandas_ta/trend/psar.py#L46) the loop starts at the wrong index 1, it should start at 2, (Line 46) Because after we do this computation: _sar = max(high.iloc[row - 1], high.iloc[row - 2], _sar) or this one _sar = min(low.iloc[row - 1], low.iloc[row - 2], _sar) when row is 1 we compare high.iloc[0] and high.iloc[-1] which is the last element of the list not the previous.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Negative index caused by undeclared identifier in 'for' statement
Error message tells you that you are trying to access an element at negative index -1. Following two array.push calls are causing the...
Read more >mql4 list array
Now in MQL4 all arrays start at 0, so it actually should be: A [0]=10, A [1]=5, A [2]=8. Learn in this MQL4...
Read more >List Index Out of Range – Python Error [Solved] - freeCodeCamp
You may get the IndexError: list index out of range error for the following reasons: Trying to access an index that doesn't exist...
Read more >pandas_ta parabolic SAR giving wrong values for yfinance ...
Coding example for the question pandas_ta parabolic SAR giving wrong values ... DataFrame(psar)["PSARr_0.2_0.2"].iloc[-1] if psar > 0: mysartrend = "Bull" ...
Read more >Accuracy Estimation and Parameter Advising for Protein ...
PSAR reports the MOS value of the original alignment with respect to these ... the algorithm assigns weight ωij := 1/d if the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@daoudjahdou,
Oops… this is the correct development branch. Improved performance, docs, typing, …
KJ
Hello @daoudjahdou,
This has been fixed. Please install the development branch to ensure it is working as expected. Let me know otherwise.
Kind Regards, KJ