ta-lib计算的数据顺序是什么

adi*_*sba 5 c# financial

我有以下蜡烛

+----------------+-------+----------+---------+----------+
|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      |
+----------------+-------+----------+---------+----------+
Run Code Online (Sandbox Code Playgroud)

我使用 TA-lib 计算 Ema 如下

public MovingAverage CalculateEMA(List<OHLC> candles, int periodsAverage)
{
    double[] closePrice = candles.Select(x => (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;
}
Run Code Online (Sandbox Code Playgroud)

问题是,以最近的入场点为顶部或底部的正确蜡烛顺序是什么?图书馆如何进行计算?在计算 Ema 之前我应该​​反转蜡烛列表吗?我对macd计算也有同样的问题

谢谢你,

Fre*_*tro 5

最早的日期/时间是数组中的第一个元素 - element[0]。时间顺序=数组顺序。您的最近一次(最后一次)应该是数组中的最后一个元素。
该逻辑适用于所有 TA-Lib 功能。