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

Calculated EMA seems not accurately #220

Open
redstrike opened this issue May 11, 2020 · 11 comments
Open

Calculated EMA seems not accurately #220

redstrike opened this issue May 11, 2020 · 11 comments

Comments

@redstrike
Copy link

redstrike commented May 11, 2020

I am trying to calculate EMA and SMA of the same data values. However, the result is the same.
When comparing to TradingView's calculated EMA, it's not matched.

image

@juanvisoler
Copy link

Same for MACD

@juanvisoler
Copy link

Probably because it's using EMA by default

@juanvisoler
Copy link

@redstrike EMA looks correct. Depending on the parameters they can yield the same results or not.

Look at this example:

const SMA = require('technicalindicators').SMA
let period = 3;
let values = [1.5554, 1.5555, 1.5558,1.5560];
SMA.calculate({period : period, values : values})

const EMA = require('technicalindicators').EMA
let period = 3;
let values = [1.5554, 1.5555, 1.5558,1.5560];
EMA.calculate({period : period, values : values})

@redstrike
Copy link
Author

@juanvisoler I did an EMA calculation with a larger dataset before trying the above simple example and compare it with other true sources such as TradingView, and believe that EMA result is not accurate.

@juanvisoler
Copy link

@redstrike can you give an example?

@redstrike
Copy link
Author

image
finmath's EMA result is more accurate as expected.
Also, I compare the result with TradingView's calculated result, so I want to report this issue.
If you believe that technicalindicators' EMA result is correct, then I have no more comment.

@southwhale
Copy link

我用EMA计算的结果也是有问题哎

@southwhale
Copy link

southwhale commented Mar 17, 2021

我用EMA计算的结果也是有问题哎

是我错了,当数据量较小时计算结果似乎不正确,但当数据量足够大时是没问题的,这个库非常棒

@southwhale
Copy link

我用EMA计算的结果也是有问题哎

是我错了,当数据量较小时计算结果似乎不正确,但当数据量足够大时是没问题的,这个库非常棒

唯一的遗憾是只能nextValue不能updateCurrentValue

@saru2020
Copy link

@anandanand84 can you please look into this issue please?
looks like this is what's causing the issue in MACD(EMA based) as mentioned here: #249 (comment)

@egranville
Copy link

Also comparing it to TradingView's EMA and seems incorrect

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

5 participants