Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev Branch: Chandelier Exit offset direction #820

Open
severin-meng opened this issue Aug 20, 2024 · 1 comment
Open

Dev Branch: Chandelier Exit offset direction #820

severin-meng opened this issue Aug 20, 2024 · 1 comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed

Comments

@severin-meng
Copy link

severin-meng commented Aug 20, 2024

Which version are you running? The lastest version is on Github. Pip is for major releases.
I am using python 3.9 and pandas_ta 0.4.19b0 (dev branch).

Do you have TA Lib also installed in your environment?
no

There is a bug in the development branch of the volatility indicator "Chandelier Exit", see here:

direction = short.shift(offset)

    direction = uptrend + downtrend
    if direction.iloc[0] == 0:
        direction.iloc[0] = 1
    direction = direction.replace(0, nan).ffill()

    # Offset
    if offset != 0:
        long = long.shift(offset)
        short = short.shift(offset)
        direction = short.shift(offset)

If you add a nonzero offset, the direction column is replaced with the shifted short column. In reality you would want the direction column to be shifted itself.
Here is what I believe to be the corrected version (only the last line is changed):

    direction = uptrend + downtrend
    if direction.iloc[0] == 0:
        direction.iloc[0] = 1
    direction = direction.replace(0, nan).ffill()

    # Offset
    if offset != 0:
        long = long.shift(offset)
        short = short.shift(offset)
        direction = direction.shift(offset)
@severin-meng severin-meng added the bug Something isn't working label Aug 20, 2024
@twopirllc twopirllc removed their assignment Aug 20, 2024
@twopirllc twopirllc added help wanted Extra attention is needed good first issue Good for newcomers labels Aug 20, 2024
@twopirllc
Copy link
Owner

Hello @severin-meng,

Doh! 🤦🏼‍♂️ Thanks for noticing the copy/paste error lol. 🤣

Kind Regards,
KJ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants