TA-Lib.NETCore icon indicating copy to clipboard operation
TA-Lib.NETCore copied to clipboard

What is BegIdx and NbElement meaning?

Open q00Dree opened this issue 3 years ago • 1 comments

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

q00Dree avatar Nov 18 '21 13:11 q00Dree

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<DateTime>> 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;
    `

SuperDaveOsbourne avatar Jun 18 '22 22:06 SuperDaveOsbourne