question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Performance of candleParts

See original GitHub issue

I noticed significant performance difference between calling an indicator and calling a candlePart on the same Quotes object.

For example, on a lengthy list (10,000 bars) the first calc below executes over 100x faster than the second calc:

var SkenderResult = quotes.GetEma(lookbackPeriods: period).Select(i => i.Ema.Null2NaN()!);

var SkenderResult = quotes.GetBaseQuote(CandlePart.HLC3);

We should check what causes such performance issue with GetBaseQuote() method - compared to other GetXXX() methods?

Results from GetBaseQuote() are so slow to calculate and return, that I rather commented them out from my validation tests for HL2, OHLC3 and others. Perhaps I don’t call the method the way I should?

Here is the link to my validation tests with your library: https://github.com/mihakralj/QuanTAlib/blob/dev/Tests/Validations/Trends/Skender.cs

Issue Analytics

  • State:closed
  • Created 9 months ago
  • Comments:25 (25 by maintainers)

github_iconTop GitHub Comments

1reaction
mihakraljcommented, Dec 26, 2022

They are more similar than you think, and the calc should follow the same logic…

T3 is a clump of 6 EMAs:

Ema1 = Ema (Close);
Ema2 = Ema (Ema1);
Ema3 = Ema (Ema2);
Ema4 = Ema (Ema3);
Ema5 = Ema (Ema4);
Ema6 = Ema (Ema5);
T3 = –(a*a*a) * Ema6 + (3*a*a + 3*a*a*a) * Ema5 + (–6*a*a – 3*a – 3*a*a*a) * Ema4 + (1 + 3*a + a*a*a + 3*a*a) * Ema3

TRIX is a clump of 3 EMAs:

Ema1 = Ema (Close);
Ema2 = Ema (Ema1);
Ema3 = Ema (Ema2);
TRIX = (Ema3-Ema3[1]) / Ema3[1]
0reactions
mihakraljcommented, Dec 26, 2022

No, check lines 41, 46, 51, 56, and 61 in https://github.com/DaveSkender/Stock.Indicators/blob/main/src/s-z/T3/T3.Series.cs

In line 61 you are warming up ema6 for SIX periods, instead of warming up all EMAs within a single period.

Looking at Tillson’s implementation, all of his T3 EMAs are primed after a single period bars. In your implementation you need a period to prime the first e1, another period to prime e2, another period for e3 and so on till e6. Six times longer, and that becomes a big issue when period is large.

Imagine T3(200) - Tillson’s implementation generates first valid result on 201st bar. Yours needs 1200 bars just for a warm-up …

Read more comments on GitHub >

github_iconTop Results From Across the Web

Candlestick Pattern Performances
The following list shows candle patterns ranked by performance in bull and bear markets over one, three, five, and ten days after the...
Read more >
How to measure the efficiency of a candlestick pattern?
The efficiency of a pattern is measured by checking the maximum price (for bullish patterns) or minimum price (for bearish patterns) within test...
Read more >
Candlestick Analysis - Performance | Dancing with the Trend
Here candle patterns performed on average over all the millions of data points, best out of the 14 technical indicators. Table D shows...
Read more >
How do you read candlesticks to evaluate the performance ...
Reversal candlestick patterns are technical analysis patterns that suggest a potential change in trend direction. These patterns can be identified on price ...
Read more >
Candlestick - Definition, Explained, Patterns, Chart, Trading
A candlestick is a technical indicator used by market analysts, participants, and traders. Using this tool, traders predict future price movements of an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found