QuanTAlib
C# TA library for real-time financial analysis, offering ~100 indicators. Available on NuGet, Quantower compatible. Ensures early validity of calculated data, calculation accuracy tested against four TA libraries.
Install / Use
/learn @mihakralj/QuanTAlibREADME
QuanTAlib 0.8.9
393 technical indicators. One library. Brutal architectural trade-offs for absolute speed.
QuanTAlib exists because I got tired of validating other people's indicators. Every implementation is cross-checked against TA-Lib, Tulip, Skender, and Pandas-TA. Where they disagree, we went to the original papers. Where the papers disagree, we picked the math that doesn't lie.
Same indicators, same results: C#, Python, and PineScript.
How Fast?
C# native AOT-compiled code spits out half a million bars of SMA in 328 microseconds. That is faster (per value) than a single L1 cache miss on any fancy new CPU. Achieved by trading object allocation for contiguous memory spans, slapping Fused Multiply-Add (FMA) on everything, and forcing SIMD vectorized paths. You want speed? We dictate the heap.
| Library | SMA (500K bars) | Allocations | Reality Check | | :--- | ---: | ---: | :--- | | QuanTAlib | 328 μs | 0 B | baseline | | TA-Lib (C++)| 365 μs | 32 B | 1.1× slower | | Tulip (C++)| 370 μs | 0 B | 1.1× slower | | Skender (C#)| 68,436 μs | 42 MB | 209× slower | | Ooples (c#)| 347,453 μs | 151 MB | 1,060× slower | Full benchmarks →
Install
| Platform | Install | Guide |
| :--- | :--- | :--- |
| .net | dotnet add package QuanTAlib | Architecture . API Reference |
| Python | pip install quantalib | Python Guide |
| PineScript v6 | Copy-paste to TradingView | PineScript Guide |
Show Me the Code
C# Streaming (Real-time incoming data, value by value)
using QuanTAlib;
var sma = new Sma(period: 14);
var result = sma.Update(110.4);
if (result.IsHot)
Console.WriteLine($"SMA: {result.Value}");
State lives inside the indicator. No list of historic bars. No LINQ chains allocating their way to thermal throttling. Call .Update(), get answer.
C# — batch (500K bars in microseconds)
double[] prices = LoadHistoricalData();
double[] results = new double[prices.Length];
Sma.Batch(prices.AsSpan(), results.AsSpan(), period: 14);
Contiguous memory. AVX-512 vectorization. The Garbage Collector sleeps through the whole thing and nobody wakes it.
Python
import quantalib as qtl
import numpy as np
prices = np.random.default_rng(42).normal(100, 2, size=500_000)
sma = qtl.sma(prices, period=14) # 393 indicators, similar syntax
Works with NumPy, pandas, polars, and PyArrow. NativeAOT compiled, ships as a binary. No CLR runtime dragged along for the ride.
Full Python guide →
PineScript
Every indicator ships as a standalone .pine file. Open it. Copy it. Paste it into TradingView. No magic, no dependencies, just math that matches the C# and Python versions to the 10th decimal.
Full PineScript guide →
393 Indicators
| Category | Count | What It Measures | Examples | | :--- | :---: | :--- | :--- | | Core | 8 | Price transforms, building blocks | AVGPRICE, MEDPRICE, TYPPRICE, HA | | Trends (FIR) | 33 | Finite impulse response averages | SMA, WMA, HMA, ALMA, TRIMA, LSMA | | Trends (IIR) | 36 | Infinite impulse response averages | EMA, DEMA, TEMA, T3, JMA, KAMA, VIDYA | | Filters | 37 | Signal processing, noise reduction | Kalman, Butterworth, Gaussian, Savitzky-Golay | | Oscillators | 48 | Bounded/centered oscillators | RSI, MACD, Stochastic, CCI, Fisher, Williams %R | | Dynamics | 21 | Trend strength and direction | ADX, Aroon, SuperTrend, Ichimoku, Vortex | | Momentum | 19 | Speed of price changes | ROC, Momentum, Velocity, TSI, Qstick | | Volatility | 26 | Price variability | ATR, Bollinger Width, Historical Vol, True Range | | Volume | 27 | Trading activity | OBV, VWAP, MFI, CMF, ADL, Force Index | | Statistics | 35 | Statistical measures | Correlation, Variance, Skewness, Z-Score | | Channels | 23 | Price boundaries | Bollinger Bands, Keltner, Donchian | | Cycles | 14 | Cycle analysis | Hilbert Transform, Homodyne, Ehlers Sine Wave | | Reversals | 12 | Pattern detection | Pivot Points, Fractals, Swings | | Forecasts | 1 | Predictive indicators | Time Series Forecast | | Errors | 26 | Error metrics, loss functions | RMSE, MAE, MAPE, SMAPE, R² | | Numerics | 27 | Mathematical transforms | Log, Exp, Sigmoid, Normalize, FFT |
Architecture (the short version)
Streaming mode: O(1) per update. Fixed memory. State maintained internally. Feed it ticks, get answers. No history buffer, no lookback window allocation, no please pass me the last 200 bars so I can waarm-up nonsense.
Batch mode: Structure-of-Arrays memory layout. SIMD vectorized. FMA everywhere the hardware allows. Processes contiguous Span<double> with zero heap allocation. Your profiler will be confused by the absence of GC pressure.
Dual-state management: Bars can be corrected mid-stream (because real-time feeds are liars). The indicator tracks both confirmed and pending state so corrections don't require a full recalculation.
Validation
Every indicator is cross-validated against reference implementations using Geometric Brownian Motion (GBM) generated test data. Not cherry-picked sine waves. Geometric Brownian Motion with realistic drift and volatility, because indicators that only work on textbook inputs are not indicators: they are demos.
Validation matrices →
Error metrics →
Trend comparison →
Documentation
Architecture & API: Architecture · API Reference · Usage Patterns · Integration (Quantower, NinjaTrader, QuantConnect)
Analysis: Benchmarks · Validation · MA Qualities · Glossary
Code Quality Assurance: NDepend · Codacy · SonarCloud · CodeFactor
⚠️ Fair Warning
Not yet 1.0.0. There is exactly one engineer behind this, running on mass amounts of caffeine and an irrational conviction that all technical indicators should be correct to the 9th decimal place. APIs will change. Things will break. Some indicators might produce values that make your quantitative models question the meaning of existence.
If you find something broken and don't open an issue, it will stay broken - I will have no idea. The backlog of things to fix is already longer than a Bollinger Band on a meme stock. Your bug reports make this library better. Your silence makes me brew more coffee.
License
Apache 2.0. Not MIT. Not BSD. Deliberately →
Related Skills
valuecell
10.3kValueCell is a community-driven, multi-agent platform for financial applications.
beanquery-mcp
45Beancount MCP Server is an experimental implementation that utilizes the Model Context Protocol (MCP) to enable AI assistants to query and analyze Beancount ledger files using Beancount Query Language (BQL) and the beanquery tool.
REFERENCE
An intelligent middleware layer between crypto wallets and traditional payment systems.
canadian-finance-planner-skill
10A Claude skill that turns Claude into your personal financial planner — built specifically for Canadians. Interviews, budgets, action plans, interactive dashboards, and ongoing coaching.
