Skip to content

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.

License

Notifications You must be signed in to change notification settings

mihakralj/QuanTAlib

Repository files navigation

Codacy grade codecov Security Rating CodeFactor
Nuget GitHub last commit Nuget .NET

Indicators Classes Files Methods Lines of Code
Public APIs Comments

Static code analysis provided by ndepend

QuanTAlib - Quantitative Technical Indicators Without Compromises

TA libraries face a fundamental choice: accept approximations for simplicity OR enforce math rigor. QuanTAlib chooses rigor.

Quantitative TA library (QuanTAlib) is a C# library built on the premise that you shouldn't have to choose. Modern CPUs process 4-8 FLOPS per cycle via SIMD. Modern .NET exposes memory layouts making hardware acceleration trivial. QuanTAlib exploits both. Result: mathematically rigorous indicators at speeds making real-time multi-symbol analysis practical on ordinary hardware.

Key Features

  • Zero Allocation: Hot paths are allocation-free. No GC pauses during trading.
  • SIMD Accelerated: Uses AVX2/AVX-512 for 8x throughput on modern CPUs.
  • O(1) Streaming: Constant time updates regardless of lookback period.
  • Platform Agnostic: Runs on .NET 8/9/10, compatible with Quantower, NinjaTrader, QuantConnect.
  • Mathematically Rigorous: Validated against original research papers and established libraries.

Indicators

Category Count What It Measures Representative Indicators
Trends (FIR) 24 Finite Impulse Response moving averages SMA, WMA, HMA, ALMA, TRIMA, LSMA, TSF
Trends (IIR) 32 Infinite Impulse Response moving averages EMA, DEMA, TEMA, T3, JMA, KAMA, VIDYA
Filters 16 Signal processing and noise reduction filters Bessel, Butterworth, Gaussian, Savitzky-Golay, Ehlers Super Smoother
Oscillators 16 Indicators that fluctuate around a center line RSI, MACD, Stochastic, AO, APO, CCI, Ultimate Oscillator
Dynamics 14 Trend strength and direction indicators ADX, Aroon, SuperTrend, Vortex, Chop, Ichimoku
Momentum 19 Speed and magnitude of price changes Momentum, ROC, Velocity, RSX, Qstick, KDJ
Volatility 20 Size and variability of price movements ATR, Bollinger Band Width, Historical Volatility, True Range
Volume 15 Trading activity and price-volume relationships OBV, VWAP, MFI, ADL, CMF, TVI, Force Index
Statistics 13 Statistical measures and tests Correlation, Variance, StdDev, Skewness, Kurtosis, Z-Score
Channels 18 Price boundaries and range definitions Bollinger Bands, Keltner Channels, Donchian Channels
Cycles 5 Cycle analysis and signal processing Hilbert Transform, Homodyne, Phasor, Ehlers Sine Wave
Reversals 7 Pattern recognition and reversal detection Pivot Points, Fractals, Swings, Pivot Components
Forecasts 4 Predictive indicators and projections Time Series Forecast, AFIRMA, Chande Forecast Oscillator
Errors 13 Error metrics and loss functions RMSE, MAE, MAPE, SMAPE, MASE, R-Squared
Numerics 5 Mathematical transformations Log, Exp, Sqrt, Tanh, ReLU, Sigmoid
Core 8 Price transforms and fundamental building blocks AVGPRICE, MEDPRICE, MIDPRICE, TYPPRICE, WCLPRICE

Browse all 229 indicators →

Quick Start

Install from NuGet:

dotnet add package QuanTAlib

Calculate an SMA in real-time:

using QuanTAlib;

var sma = new Sma(period: 14);
double price = 100.0;

// Update with new price
var result = sma.Update(new TValue(DateTime.UtcNow, price));

if (result.IsHot)
{
    Console.WriteLine($"SMA: {result.Value}");
}

Performance Snapshot

QuanTAlib is designed for speed. Here is how it compares calculating a 500,000 bar SMA against other libraries:

Library Mean Time Allocations Relative Speed
QuanTAlib (Span) 318.3 μs 0 B 1.00x (baseline)
TA-Lib 356.4 μs 34 B 1.12x slower
Tulip Indicators 359.3 μs 0 B 1.13x slower
Skender Indicators 71,277 μs 50.8 MB 224x slower

See Benchmarks for full details and methodology.

Documentation

Core Concepts

  • Architecture: Learn about SoA layout, SIMD, and design philosophy.
  • API Reference: Deep dive into the Tri-Modal Architecture (Batch, Streaming, Priming).
  • Indicators: Full catalog of available indicators and their mathematical families.
  • Usage Guides: Detailed patterns for Span, Streaming, Batch, and Eventing modes.
  • Integration: Setup guides for Quantower, NinjaTrader, and QuantConnect.

Analysis & Validation

  • Benchmarks: Detailed performance evidence and test methodology.
  • Error Metrics: Implementation details for 20+ error metrics and loss functions.
  • Trend Comparison: Comparative analysis of lag, smoothness, and accuracy.
  • MA Qualities: Theoretical framework for evaluating moving averages.
  • Validation: Verification matrices against TA-Lib, Skender, and other libraries.
  • Glossary: Definitions of core QuanTAlib concepts, types, and terminology.

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 7

Languages