I'm trying to use TA-Lib for technical analysis. I downloaded TA-Lib-Core Nuget package for .NET. Unfortunately, I can't find any API documentation so some method parameters are a bit of mystery.
I downloaded historical data for AMD between 4/12/2016 and 4/12/2017 here.
This is what I have for RSI and MACD calculations:
int outBegIdx1, outNBElement1;
double[] outReal = new double[data.Count];
int outBegIdx2, outNBElement2;
double[] outMACD = new double[data.Count];
double[] outMACDSignal = new double[data.Count];
double[] outMACDHist = new double[data.Count];
TicTacTec.TA.Library.Core.Rsi(0, data.Count - 1, data.Select(x => x.Close).ToArray(), 14, out outBegIdx1, out outNBElement1, outReal);
TicTacTec.TA.Library.Core.Macd(0, data.Count - 1, data.Select(x => (float)x.Close).ToArray(), 12, 26, 9, out outBegIdx2, out outNBElement2, outMACD, outMACDSignal, outMACDHist);
I'm comparing the results to TradingView's AMD page here. To see RSI and MACD values, please click "Indicators" at the top and select those. Also you should be looking at the 1 year daily chart.
The problem is TA-Lib is outputting vastly different results, and I'm not sure if I'm using these APIs correctly. What I'm seeing is 65.34 for RSI and 0.0431 for MACD Histogram as opposed to TradingView's 39.42 and -0.2165 respectively.
Please note that data[0]
has the close price for 4/12/2016 whereas the last element is for 4/12/2017. Also I have no idea what outBegIdx
and outNBElement
parameters stand for.
How do I return correct values?