0

I am using the Ta-lib library in my C# project to calculate Exponential moving averages. I have to calculate EMA for 20 periods. I did my calculation on a spreadsheet (Excel) and I got the correct result; while using the same data points with ta-lib library I am getting wrong result.

I am using close price from the attached image.

Core.Ema(startIdx, endIdx, close, 20, out outBegIdx, out outNBElement, smoothClose);

after running ta-lib function my result is

113.783380952381
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

While running the EMA formula on Excel with same period values my result is mentioned in attached image

enter image description here

4

1 回答 1

1

另一个注意事项是您的数据顺序是相反的。日期应该在您的数组中升序,最新日期是最后一个条目,最早日期是第一个条目

于 2020-04-24T17:43:27.653 回答