title: What is the data order for ta-lib calculations
body: <p>I have the following candles </p>
  
  <pre><code>+----------------+-------+----------+---------+----------+
  |date            |curency|high_price|low_price|last_price|
  +----------------+-------+----------+---------+----------+
  |2014-01-16 16:07|2      |24.98     |23.9     |24.2      |
  +----------------+-------+----------+---------+----------+
  |2014-01-16 16:06|2      |24.98     |23.9     |24.12202  |
  +----------------+-------+----------+---------+----------+
  |2014-01-16 16:05|2      |24.98     |23.9     |24.12202  |
  +----------------+-------+----------+---------+----------+
  |2014-01-16 16:04|2      |24.98     |23.9     |24.21626  |
  +----------------+-------+----------+---------+----------+
  |2014-01-16 16:03|2      |24.98     |23.9     |24.11102  |
  +----------------+-------+----------+---------+----------+
  |2014-01-16 16:02|2      |24.98     |23.9     |24.21628  |
  +----------------+-------+----------+---------+----------+
  |2014-01-16 16:01|2      |24.98     |23.9     |24.2      |
  +----------------+-------+----------+---------+----------+
  |2014-01-16 16:00|2      |24.98     |23.9     |24.2      |
  +----------------+-------+----------+---------+----------+
  </code></pre>
  
  <p>I use TA-lib to calculate Ema's as follows</p>
  
  <pre><code>public MovingAverage CalculateEMA(List&lt;OHLC&gt; candles, int periodsAverage)
  {
      double[] closePrice = candles.Select(x =&gt; (double)x.last_price).ToArray();
      double[] output = new double[closePrice.Length];
      int begin;
      int length;
  
      TicTacTec.TA.Library.Core.RetCode retCode = Core.Ema(0, closePrice.Length - 1, closePrice, periodsAverage, out begin, out length, output);
  
      if (retCode == TicTacTec.TA.Library.Core.RetCode.Success)
          return new MovingAverage() { Begin = begin, Length = length, Output = output, Period = periodsAverage };
  
      return null;
  }
  </code></pre>
  
  <p>Question is whats the correct candle order with the most recent entry as top or bottom?
  How does the library make the calculation ? should i reverse candles list before Calculating Ema?
  Also i have the same question for macd calculation</p>
  
  <p>Thank you,</p>