ta-rs
ta-rs copied to clipboard
Feat: Add weighted moving average (WMA)
Hey there, this PR implements the weighted moving average indicator, which assigns weights that decrease linearly (n, n-1, etc) as opposed to exponentially as in the EMA.
From what I can see the WMA seems to be a requirement to implement the hull moving average (Issue #36), which I'll likely be tackling next.
Update: I finished implementing the hull moving average on this branch. If you'd like I can merge that with this pull request, or just submit a new one later.
Edit: Solves #36
My PR now also includes all three new indicators merged from @menkaru's resp. branches.
@menkaru, is your branch for QuantitativeQualitativeEstimation
WIP/unfinished? The indicators::quantitative_qualitative_estimation::tests::test_next
for this feature fails for me:
thread 'indicators::quantitative_qualitative_estimation::tests::test_next' panicked at 'assertion failed: `(left == right)`
left: `(44.52, 24.53)`,
right: `(46.11, 23.18)`', src/indicators/quantitative_qualitative_estimation.rs:241:9
@virtualritz, it's been a while but iirc I ran into issue #46 due to all the EMAs required. It's pretty much done, but it just gives slightly different results to the reference I used (pandas_ta) to generate the test cases.
What does "pretty much done" mean? You consider it close enough and won't touch the code or minor tweaks are needed to fix? In the former case we could just update the test case values, I guess?
Sorry, I should have been more specific. The implementation is correct and complete. From what I can tell the problem is the same as issue #46, which seems to require structural changes to the library. I considered changing the test cases, but the results didn't seem close enough to warrant it.
For what it's worth, I wouldn't merge it until a fix for #46 is decided on.
@menkaru Sorry, it took way too long.. Thanks for the PR!