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
One other note is that your data order is reversed. The dates should be ascending in your array with the latest date being the last entry and the earliest date being the first entry
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.