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

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Static code analysis provided by ndepend:
Files Classes Methods LoC
Public API Comments Complexity

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

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