0

I'm trying to calculate the +DI and -DI values (period 28) using the TA-lib library. The values I am getting are not similar to the values on my charting platform. Please find my code below and let me know if I'm missing anything. Also, the ADX value returned from the TA-lib is also wrong. Thanks.

Below, you'll find the code to calculate the +DI using the TA-lib library. The value returned by the library is far from the value I see on my charting platform. The only inputs are highPrices, lowPrices and closePrices. These are arrays contains the high, low and closing prices. The values in these arrays match the values on my charting platform and yet the value returned is wrong.

Thanks for your time.

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;
Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92

0 Answers0