[This article was first published on R-posts.com, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.{talib} is a newR-package for Technical Analysis (TA) and CandlestickPattern Recognition (Yeah, the patterns traders bet their lifesavingson….). In this post I will show basic example on how {talib} works, and how itcompares performance-wise with {TTR}.Basic exampleIn this example I will identify all ‘Harami’ patterns, and calculatethe Bollinger Bands of the SPDR S&P 500 ETF (SPY).Identify Harami patternsx identified patterns: 35The Harami pattern can be bullish (1) or bearish (-1) and counted thesame waycat( "identified bullish patterns:", sum(x[, 1] == 1, na.rm = TRUE))#> identified bullish patterns: 20cat( "identified bearish patterns:", sum(x[, 1] == -1, na.rm = TRUE))#> identified bearish patterns: 15ChartingThe Harami pattern can be plotted using talib::chart()with talib::bollinger_bands() to add Bollinger Bands to thechart.{ talib::chart(talib::SPY) talib::indicator(talib::harami) talib::indicator(talib::bollinger_bands)}BenchmarksAn often asked question about {talib} in relation to {TTR}, is what it “bringsto the table”. Other than Candlestick Patterns and interactive charts,it brings speed and efficiency.To demonstrate the difference in speed, I will create a univariateprice series with 1 million entries.set.seed(1903)x Warning: Some expressions had a GC in every iteration; so filtering is#> disabled.#> # A tibble: 2 × 4#> expression min median mem_alloc#> #> 1 talib::bollinger_bands(x) 6.65ms 9.07ms 22.9MB#> 2 TTR::BBands(x) 65.12ms 72.42ms 139.3MBIn this benchmark {talib} is faster, andmore memory efficient, than {TTR}.{talib} is stillunder development, and will most likely not be submitted to CRAN beforenext year. Until then it can be installed from Github:pak::pak("serkor1/ta-lib-R")Feel free to stop by the repository here: https://github.com/serkor1/ta-lib-R.Created on 2025-11-16 with reprex v2.1.1{talib}: Candlestick Pattern Recognition in R was first posted on November 16, 2025 at 8:06 pm.To leave a comment for the author, please follow the link and comment on their blog: R-posts.com.R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.Continue reading: {talib}: Candlestick Pattern Recognition in R