Skip to content
This repository has been archived by the owner on Sep 2, 2022. It is now read-only.

PSAR has a side effect #123

Open
AGG2017 opened this issue Aug 8, 2021 · 2 comments
Open

PSAR has a side effect #123

AGG2017 opened this issue Aug 8, 2021 · 2 comments

Comments

@AGG2017
Copy link

AGG2017 commented Aug 8, 2021

After using PSAR I see that the original data for "close" in ohlc has changed and calling any other function after PSAR will produce wrong results because "close" price is already different.

It is very easy to see that getting the close price by psar=close[0:len(close)] will not create a copy but will be optimized to create a reference to close and any change of psar later will affect the original close values.

One easy fix is to be replaced by psar = close.copy()

@peerchemist
Copy link
Owner

I dislike PSAR code, I am thinking about removing it until it's rewritten into something more pythonic/pandas.

@kieran-mackle
Copy link

To add to this, psar.psarbear and psar.psarbull are identical. I believe this might be another case of the issue above, where the same variable is being implicitly referenced, leading to unexpected results.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants