TA-Lib
0.8.3
dotnet add package TA-Lib --version 0.8.3
NuGet\Install-Package TA-Lib -Version 0.8.3
<PackageReference Include="TA-Lib" Version="0.8.3" />
<PackageVersion Include="TA-Lib" Version="0.8.3" />
<PackageReference Include="TA-Lib" />
paket add TA-Lib --version 0.8.3
#r "nuget: TA-Lib, 0.8.3"
#:package TA-Lib@0.8.3
#addin nuget:?package=TA-Lib&version=0.8.3
#tool nuget:?package=TA-Lib&version=0.8.3
TA-Lib for .NET
TA-Lib, the widely used technical-analysis library, as a pure managed .NET library: 200+ indicators covering moving averages, momentum oscillators (RSI, MACD, Stochastic), volatility (Bollinger Bands, ATR), volume, Hilbert Transform cycle analysis, statistics, price transforms and candlestick patterns.
Every function is generated from the same canonical definitions as the C library and is
bit-identical to the C reference implementation over the same inputs, except where a
calculation calls a transcendental math function such as exp or log: .NET's math library
can round that result differently from the C library in the last bit, which is beyond
TA-Lib's control, and the difference can grow through the rest of the calculation. No native
binaries, no P/Invoke, no dependencies.
Install
dotnet add package TA-Lib
The package is TA-Lib; the namespace is TALib. It targets net10.0.
Quick start
using TALib;
var core = Core.Default;
double[] close = [ /* ...your closing prices... */ ];
var outReal = new double[close.Length];
OutRange r = core.Sma(0, close.Length - 1, close, 30, outReal);
// outReal[0 .. r.Count - 1] holds the SMA; outReal[i] is input bar r.BegIdx + i.
for (int i = 0; i < r.Count; i++)
Console.WriteLine($"bar {r.BegIdx + i} = {outReal[i]}");
Every indicator is a method on Core with the same calling pattern: a startIdx/endIdx
range, input spans, parameters, caller-provided output spans, and an OutRange saying where
the values start and how many there are. A range that ends inside the lookback is a success
with no values, not an error. Invalid arguments throw.
Configuration
Core is immutable. The value-affecting settings, the unstable period and the candlestick
thresholds, are chosen up front and then frozen, so one Core can be shared across threads:
Core tuned = Core.Builder()
.UnstablePeriod(FuncUnstId.EMA, 10)
.Build();
Live data
For a feed that arrives one bar at a time, each indicator also has a streaming form: open it on the history you already have, then each closed bar in gives that bar's value out, bit-identical to the batch call.
Core.SmaStream s = core.SmaOpen(close, 30);
double v = s.Update(newClose); // a closed bar: commits it
double provisional = s.Peek(formingClose); // the forming bar: commits nothing
Documentation
- C# guide: https://ta-lib.org/api/csharp/, and the streaming tier: https://ta-lib.org/api/csharp/stream/
- Per-function reference (formulas, notes, sources): https://ta-lib.org/functions/
- Source: https://github.com/TA-Lib/ta-lib
License
BSD-3-Clause, see LICENSE.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on TA-Lib:
| Package | Downloads |
|---|---|
|
MoonMachine.StrategyTemplate
A template for a moonmachine strategy |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on TA-Lib:
| Repository | Stars |
|---|---|
|
sthewissen/Mynt
An Azure Functions-based crypto currency trading bot; featuring 10 exchanges, 25 indicators, custom strategy support, backtester and more
|