0

我正在尝试使用 TA-lib 库计算 +DI 和 -DI 值(周期 28)。我得到的值与我的图表平台上的值不相似。请在下面找到我的代码,如果我遗漏了什么,请告诉我。此外,从 TA-lib 返回的 ADX 值也是错误的。谢谢。

下面,您将找到使用 TA-lib 库计算 +DI 的代码。库返回的值与我在图表平台上看到的值相差甚远。唯一的输入是 highPrice、lowPrice 和 closePrice。这些是包含最高价、最低价和收盘价的数组。这些数组中的值与我的图表平台上的值匹配,但返回的值是错误的。

谢谢你的时间。

double[] output = new double[closePrices.Length];
int begin;
int length;

Core.RetCode retCode = Core.PlusDI(closePrices.Length - 1, closePrices.Length - 1, highPrices, lowPrices, 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);
    }
}
return result;
4

0 回答 0