hmG3 / TA-Lib.NETCore

📈 A modern port to .NET (C#) of Technical Analysis Library

Home Page:https://hmg3.github.io/TaTooIne

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

What is BegIdx and NbElement meaning?

q00Dree opened this issue · comments

Can't find documentation for these arguments, can somebody help me and describe them?

If you think about it a little bit, you would see that the numbers add up to the total sequence. There is some lag to some indicators so the first possible candle that could be a match might be several bars in. The same at the end I suppose. So these are offsets to let you figure out how to relate it to the bar from the calling sequence of hlocv data.

` public static async Task<List> GetCandleStickType(string ticker, int ticks)
{
await using var context1 = new Context();

        var quoteList = context1.QuoteDatas
            .AsQueryable()
            .Where(t => t.Symbol == ticker)
            .OrderByDescending(d => d.QuoteDate)
            .Take(ticks)
            .Reverse()
            .ToList();
        
        var open = quoteList.Select(o => o.OpenPrice).ToArray();
        var high = quoteList.Select(h => h.HighPrice).ToArray();
        var low = quoteList.Select(l => l.LowPrice).ToArray();
        var close = quoteList.Select(c => c.ClosePrice).ToArray();

        var resultArrayDoji = new int[quoteList.Count - 1];
        _ = TALib.Core.CdlEngulfing(open, high, low, close, 0, quoteList.Count - 1,
            resultArrayDoji, out var begIndex, out var nbElement);

        
        var dojiList = new List<DateTime>();

        var i = 0;
        foreach (var entry in resultArrayDoji)
        {
            if (entry != 0 && quoteList[i + begIndex].ClosePrice > quoteList[i + begIndex].OpenPrice)
            {
                dojiList.Add(quoteList[i + begIndex].QuoteDate);
            }

            i++;
        }
        
        return dojiList;
    `