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

hma is not exponential hull moving average but in docs it is mentioned as exponential moving average #868

Open
XotEmBotZ opened this issue Dec 30, 2024 · 9 comments
Labels
bug Something isn't working

Comments

@XotEmBotZ
Copy link

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

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

Have you tried the development version? Did it resolve the issue?
Yes tried but not fixed yet

Describe the bug
The docs mentions hma as * _Hull Exponential Moving Average_: **hma** But after comparison it is not exponential.

To Reproduce

data["hma180"] = ta.hma(data["close"], 180)

Expected behavior
Should provide exponential hull moving average not hull moving average.
Else the docs should be changed to null moving average

Additional context
If hull moving average is the correct output can I give a PR for EHMA. If yes then mention the correct procedure

@XotEmBotZ XotEmBotZ added the bug Something isn't working label Dec 30, 2024
@twopirllc twopirllc removed their assignment Dec 30, 2024
@twopirllc
Copy link
Owner

Hey @XotEmBotZ

Thanks for the catch! 🤦🏼‍♂️

Yeah, it’s the standard Hull Moving Average, hma, and not Hull Exponentional Moving Average. I can update the doc on my next push.

Thanks,
KJ

@XotEmBotZ
Copy link
Author

I want exponential moving average also. When can i see ehma in the development branch?

@twopirllc
Copy link
Owner

@XotEmBotZ

You are talking about this?

//@version=5
indicator("EHMA", overlay = true)
hma(src, len)=>
    ta.ema(2 * ta.ema(src, int(len/2)) - ta.ema(src, len), int(math.sqrt(len/2)))

Source = input.source(close)
Length = input.int(50, minval = 2)
hma = hma(Source, Length)
hma_dif = hma - hma[1]
colour = math.sign(hma_dif) == 1 ? color.green : color.red
plot(hma, "EHMA", colour)

Should be doable with replacing wma with ma and setting mamode to default to “hma”. Then you can select whichever ma you want.

As an example, see hilo, kama, smma, supertrend, et al…

Should be an easy PR to hma if that is a case… if you want a standalone, then a separate PR for ehma woul d be required.

@XotEmBotZ
Copy link
Author

Both approach works for me. Its up to you to decide which approach is better since you know the library structure better than me.

@XotEmBotZ XotEmBotZ mentioned this issue Jan 3, 2025
@XotEmBotZ
Copy link
Author

@twopirllc
Not sure where to tell it so using this issue to tell it.
Since this is a public repo should you enable the discussion page also?
Then "questions" can be moved to discussion page rather than creating a issue for it.

@twopirllc
Copy link
Owner

Sounds good. But I don’t have the time to manage another feature.

Regarding:

Should be doable with replacing wma with ma and setting mamode to default to “hma”. Then you can select whichever ma you want.

This is the recommended solution as it is easier to implement and is the most flexible.

@XotEmBotZ
Copy link
Author

@twopirllc
I have created pull requests for both type of implementation
#870 For ehma
#872 for mamode in hma

Kindly merge which one you like and close the other.

! On the side note enable the discussion tab in this repo. you dont have to actively interact in that as important things for you will still be in issues.

@XotEmBotZ
Copy link
Author

Can I expect it to be merged before 11th?

@twopirllc
Copy link
Owner

twopirllc commented Jan 7, 2025

@XotEmBotZ

No. I have a lot of stuff on my plate. There is a lot of stuff to update and it will be worked into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants