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

C# ta lib计算的数据顺序是什么,c#,financial,C#,Financial,我有下列蜡烛 +----------------+-------+----------+---------+----------+ |date |curency|high_price|low_price|last_price| +----------------+-------+----------+---------+----------+ |2014-01-16 16:07|2 |24.98 |23.9 |24.2 | +------

我有下列蜡烛

+----------------+-------+----------+---------+----------+
|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      |
+----------------+-------+----------+---------+----------+
我使用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;
}
public moving average CalculateEMA(列出蜡烛、整数周期保存期限)
{
double[]closePrice=蜡烛。选择(x=>(double)x.last_price.ToArray();
double[]输出=新的double[closePrice.Length];
int开始;
整数长度;
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)
返回新的MovingAverage(){Begin=Begin,Length=Length,Output=Output,Period=periodsAverage};
返回null;
}
问题是,最新的条目是顶部还是底部,正确的蜡烛顺序是什么? 图书馆是如何计算的?我应该在计算均线前反转蜡烛列表吗? 对于macd计算,我也有同样的问题

谢谢,

公共静态双TA_MACDTest(int startIdx、int endIdx、Object[]InputValues、int fastemariods、int SlowEMAPeriods、int SignalEMAPeriods)
public static double TA_MACDTest(int startIdx,int endIdx,Object[] InputValues, int FastEMAPeriods, int SlowEMAPeriods, int SignalEMAPeriods)
{
    int i = 1;
    double[] newInputValues = new double[InputValues.Count()];
    int intItr = 0;
    foreach (object objValue in InputValues)
    {
        newInputValues[intItr] = Convert.ToDouble(objValue);
        intItr = intItr + 1;
    }
    int outBegIdx;
    int outNBElement;

    double[] outMACD = new double[endIdx - startIdx + 1];
    double[] outMACDSignal = new double[endIdx - startIdx + 1];
    double[] outMACDHist = new double[endIdx - startIdx + 1];

    Core.RetCode res = Core.Macd(startIdx, endIdx, newInputValues, FastEMAPeriods, SlowEMAPeriods, SignalEMAPeriods, out  outBegIdx, out  outNBElement, outMACD, outMACDSignal, outMACDHist);
    List<Macdres> resarr = new List<Macdres>(endIdx - startIdx + 1);
    Macdres macdres = new Macdres();
    macdres.Index = i;
    macdres.Macd = outMACD.Last();
    macdres.Signal = outMACDSignal[i];
    macdres.MacdHistogram = outMACDHist[i];
    return macdres.Macd;
}
{ int i=1; double[]newInputValues=新的双精度[InputValues.Count()]; int intItr=0; foreach(InputValues中的对象objValue) { newInputValues[intItr]=转换为双值(objValue); intItr=intItr+1; } int outBegIdx; int-outNBElement; double[]outMACD=新的double[endIdx-startIdx+1]; double[]outMACDSignal=新的double[endIdx-startIdx+1]; double[]outMACDHist=新的double[endIdx-startIdx+1]; Core.RetCode res=Core.Macd(startIdx、endIdx、newInputValues、fastemPeriods、SlowEMAPeriods、SignalEMAPeriods、out-outBegIdx、out-outNBElement、outMACD、outMACDSignal、outMACDHist); List resarr=新列表(endIdx-startIdx+1); Macdres Macdres=新Macdres(); macdres.Index=i; macdres.Macd=outMACD.Last(); macdres.Signal=outMACDSignal[i]; macdres.MacdHistogram=outMACDHist[i]; 返回macdres.Macd; }
最早的日期/时间是数组中的第一个元素-元素[0]。按时间顺序=数组顺序。您最近的时间(最后一次)应该是数组中的最后一个元素。
此逻辑适用于所有TA Lib函数。

我在C#项目中使用TA Lib,但仍停留在EMA计算中。你能检查一下我的问题并相应地回答我吗。