question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Psar loop starting at wrong index 1

See original GitHub issue

Pandas 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:closed
  • Created 2 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
twopirllccommented, Feb 9, 2022

@daoudjahdou,

Oops… this is the correct development branch. Improved performance, docs, typing, …

$ pip install -U git+https://github.com/twopirllc/pandas-ta.git@development

KJ

0reactions
twopirllccommented, Dec 14, 2021

Hello @daoudjahdou,

This has been fixed. Please install the development branch to ensure it is working as expected. Let me know otherwise.

$ pip install -U git+https://github.com/twopirllc/pandas-ta

Kind Regards, KJ

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found