[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 built on TA-Lib, which is nowavailable on CRAN. The R-package is targeted at individualsand, perhaps, institutions who, in some form or the other, interactswith the financial markets using technical analysis.The library is built with minimal dependencies for long-termstability and freedom in mind. All functions are built arounddata.frame– and matrix-classes which areportable to all other data-containers with minimal effort.Everything in the library is built ‘bottom-up’ for maximum speed andmemory efficiency. Each indicator interacts directly with R’s C API via.Call().In this blog post I will give a brief introduction to the interfaceand the most important aspects of the package. The library also includesstatic and interactive financial charts, which will be covered in adifferent post.A quick introduction to the interfaceIn this section I will briefly introduce the most important aspectsof the function calls, formals and how arehandled. Below is a simple starting point; calculating the BollingerBands for Bitcoin:tail( talib::bollinger_bands( talib::BTC ))#> UpperBand MiddleBand LowerBand#> 2024-12-26 01:00:00 100487.38 96698.61 92909.83#> 2024-12-27 01:00:00 100670.65 96512.96 92355.27#> 2024-12-28 01:00:00 100632.13 96581.91 92531.69#> 2024-12-29 01:00:00 99628.77 95576.60 91524.43#> 2024-12-30 01:00:00 96403.53 94231.31 92059.09#> 2024-12-31 01:00:00 95441.13 93774.23 92107.34In itself a simple call. Below are the formals:str(formals(talib::bollinger_bands))#> Dotted pair list of 8#> $ x : symbol #> $ cols : symbol #> $ ma : language SMA(n = 5)#> $ sd : num 2#> $ sd_down : symbol #> $ sd_up : symbol #> $ na.bridge: logi FALSE#> $ ... : symbolAll functions share the same signature x,cols, na.bridge and ..., whileeverything else is indicator-specific. The cols-argument ismissing, but has a default value hard-coded against the upstream TA-Lib – this is also truefor the remaining indicators. The cols-argument accepts aone-sided formula as follows:tail( talib::bollinger_bands( talib::BTC, cols = ~close ))#> UpperBand MiddleBand LowerBand#> 2024-12-26 01:00:00 100487.38 96698.61 92909.83#> 2024-12-27 01:00:00 100670.65 96512.96 92355.27#> 2024-12-28 01:00:00 100632.13 96581.91 92531.69#> 2024-12-29 01:00:00 99628.77 95576.60 91524.43#> 2024-12-30 01:00:00 96403.53 94231.31 92059.09#> 2024-12-31 01:00:00 95441.13 93774.23 92107.34In this case the resulting data.frame is the same asabove, as the default column for which the bands are calculated is theclosing price of the asset.All indicators are wrapped by model.frame() and itsfunctionality can be accessed via ... as follows:tail( talib::bollinger_bands( talib::BTC, cols = ~close, subset = 1:nrow(talib::BTC) %in% 1:100 ))#> UpperBand MiddleBand LowerBand#> 2024-04-04 02:00:00 72605.20 68193.82 63782.44#> 2024-04-05 02:00:00 70646.91 67502.88 64358.84#> 2024-04-06 02:00:00 70087.36 67344.94 64602.52#> 2024-04-07 02:00:00 70475.41 68122.29 65769.16#> 2024-04-08 02:00:00 71820.87 69249.88 66678.89#> 2024-04-09 02:00:00 71848.20 69372.65 66897.09Here we only calculate the indicator on a subset of theBTC. While this may seem like a redundant ‘wow’-feature atfirst glance, its primary justification is in the charting interfacewhere only parts of an indicator is of visual interest.The -handling in {talib} works abit differently than na.rm. Before I demonstrate this, weadd some missing values randomly to BTCBTC 2024-12-26 01:00:00 NA NA NA#> 2024-12-27 01:00:00 NA NA NA#> 2024-12-28 01:00:00 NA NA NA#> 2024-12-29 01:00:00 NA NA NA#> 2024-12-30 01:00:00 NA NA NA#> 2024-12-31 01:00:00 NA NA NAWhich returns for all values. This is thedefault behaviour. The function faithfully returns the full object withthe same number of rows – filled with-values.To avoid this you can set na.bridge = TRUE asfollows:tail( object UpperBand MiddleBand LowerBand#> 2024-12-26 01:00:00 100487.38 96698.61 92909.83#> 2024-12-27 01:00:00 100670.65 96512.96 92355.27#> 2024-12-28 01:00:00 100632.13 96581.91 92531.69#> 2024-12-29 01:00:00 99628.77 95576.60 91524.43#> 2024-12-30 01:00:00 96403.53 94231.31 92059.09#> 2024-12-31 01:00:00 95441.13 93774.23 92107.34Again, with the same number of rows as BTC. Thisbehaviour is true for all functions: N-rows in,N-rows out. What na.bridge is doing under thehood, is to extract all -values, calculate theindicator and then re-adds them in their original position.Installation{talib} is finally on CRAN, and can be installed asfollows:install.packages("talib")It can also be built from source with additionalCMake-flags:install.packages( "talib", type = "source", configure.args = "-O3 -march=native")Contributing and submitting bug-reports{talib} is still in its early stage so contributions,even if small, bug-reports, suggestions and critiques are gratefullyaccepted.Visit the repository here: https://github.com/serkor1/ta-lib-R.Created on 2026-04-24 with reprex v2.1.1{talib}: Technical Analysis using R was first posted on April 27, 2026 at 1:00 am.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}: Technical Analysis using R