【发布时间】:2015-10-12 17:51:58
【问题描述】:
当我使用 TA-lib 计算任何时期的 SMA 和 EMA 值时,这些值总是相等的。其他人有这方面的经验吗?谢谢。
Ema 代码(我只是将 Core.Ema 替换为 SMA 的 Core.Sma):
double[] output = new double[closePrices.Length];
int begin;
int length;
Core.RetCode retCode = Core.Ema(closePrices.Length - 1, closePrices.Length - 1, closePrices, period, out begin, out length, output);
if (retCode == Core.RetCode.Success)
{
for (int i = 0; i < length; i++)
{
result = Math.Round(output[i], 5);
}
}
【问题讨论】:
-
不。它应该工作。请提供代码示例。
-
嗨 truf。我已将代码添加到我的原始帖子中。谢谢。
-
如果能获得数据样本来重现问题,那就太好了。你的
period值是多少?如果删除Math.Round,您确定值相等吗?
标签: ta-lib