When I calculate the SMA and EMA values using TA-lib for any period, the values are always equal. Does anyone else has any experience on this? Thanks.
Code for Ema (I just replace Core.Ema with Core.Sma for 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);
}
}