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

Indicators using moving averages variable does not pass kwargs to ma(mamode, close, length=length) #764

Open
PiotrJuzwiak opened this issue Feb 11, 2024 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@PiotrJuzwiak
Copy link

PiotrJuzwiak commented Feb 11, 2024

Which version are you running? The lastest version is on Github. Pip is for major releases.

import pandas_ta as ta
print(ta.version) 2.1.4

Do you have TA Lib also installed in your environment?

$ pip list

Yes

Have you tried the development version? Did it resolve the issue?

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

No

Describe the bug
Many indicators e.g. Keltner Channel is using internally ma(mamode, close, length) but it should have
ma(mamode, close, length, kwargs)
Many moving averages e.g linreg have extra kwargs that are not passed further
So for example passing kwargs to kc Class is not passing those kwargs to be used when calculating moving average.

To Reproduce
Provide sample code.

    if mamode == 'linreg':
        kwargs={'degrees': True, 'slope': True, 'tsf': True}
    print(kwargs)

    kc_var = kc(close=df['close'], high=df['high'], low=df['low'], length=p_length, mamode=mamode, scalar=p_scalar, kwargs=kwargs)

Expected behavior
A clear and concise description of what you expected to happen.
When calling should have kwargs passed into it e.g. ma(mamode, close, length, kwargs)

Inside kc

# Calculate Result
    use_tr = kwargs.pop("tr", True)
    if use_tr:
        range_ = true_range(high, low, close)
    else:
        range_ = high_low_range(high, low)
#SHOULD BE BELOW
    basis = ma(mamode, close, length=length, kwargs)
    band = ma(mamode, range_, length=length, kwargs)

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!

@PiotrJuzwiak PiotrJuzwiak added the bug Something isn't working label Feb 11, 2024
@twopirllc twopirllc removed their assignment Feb 13, 2024
@twopirllc twopirllc added help wanted Extra attention is needed good first issue Good for newcomers enhancement New feature or request and removed bug Something isn't working labels Feb 13, 2024
@twopirllc
Copy link
Owner

Hello @PiotrJuzwiak

Pandas TA is not even 1.0.0+ let alone 2.1.4.

So I assume you are on v0.3.14.

Yes, some indicators, like kc, have not had their internal ma(mamode, x, length=length) accept **kwargs yet. Should be a relatively easy PR to update all the indicators that match = ma(mamode, and append , **kwargs) to it. Currently overloaded with PRs and Issues.

Kind Regards
KJ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants