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

[transducers-stats] Supported indicators MACD #31

Closed
sy92th opened this issue Jul 25, 2018 · 6 comments
Closed

[transducers-stats] Supported indicators MACD #31

sy92th opened this issue Jul 25, 2018 · 6 comments

Comments

@sy92th
Copy link

sy92th commented Jul 25, 2018

Is the library supporting the MACD indicators?
If not, can indicators be made soon?

@postspectacular
Copy link
Member

Added and released as v0.3.0 😄

@postspectacular
Copy link
Member

Please use v0.3.1 instead...

postspectacular added a commit that referenced this issue Jul 29, 2018
* develop:
  Publish
  fix(transducers-stats): fix naming of MACD results (#31)
  Publish
  docs(transducers-stats): update docs & readme
  feat(transducers-stats): add BollingerBand value interface
  feat(transducers-stats): add MACD (fixes #31)
  docs(transducers): update readmes
  Publish
  feat(transducers-stats): add stochastic oscillator, refactor
  feat(examples): add MA mode dropdown, update crypto-chart dataflow
  refactor(examples): switch to WMA plots in crypto-chart demo
  docs: update main readme
@sy92th
Copy link
Author

sy92th commented Aug 1, 2018

I use version "^0.3.1"

const chartDataMACD = Array.from(tx.iterator(stats.macd(fastPeriod, slowPeriod, signalPeriod), closeArray));
console.log('Length MACD: ' + chartDataMACD.length);
console.log('Length data: ' + closeArray.length);

result (with fast: 12, slow: 26, smooth: 9):
Length MACD: 52252
Length data: 52285 (expected: 52252 +26 -1 = 52277)

Can you check this problem? I think the MACD is being miscalculated.

@postspectacular
Copy link
Member

Hey @sy92th - did you read the docs?

https://github.com/thi-ng/umbrella/blob/master/packages/transducers-stats/src/macd.ts#L34

You didn't take into account the 2nd moving average smooth applied to difference between the fast and slow ones. That's why the total lag of the indicator is slow + smooth - 2...

52285-(26+9-2) = 52252

@postspectacular
Copy link
Member

@sy92th
Copy link
Author

sy92th commented Aug 2, 2018

Ahh I'm wrong. So sorry

@sy92th sy92th closed this as completed Aug 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants