Overview Benchmarks Q&A News
v1.0-rc · MIT · header-only
Backtesting Engine · C++23 · header-only

StratForge.
The hot path, forged.

A high-performance C++23 backtesting engine with 138+ built-in indicators and vectorized execution. Zero heap allocations on the hot path: deterministic, reproducible, fast.
Compile once. Backtest forever.

stratforge / examples / bollinger_bands.hpp
CLANG 18 · -O3 · -std=c++23 · NATIVE
bollinger_bands.hppstrategy.hppmain.cpp
  1#include <stratforge/indicators.hpp>
  2#include <stratforge/strategy.hpp>
  3
  4template<size_t N = 20>
  5struct BollingerBreakout {
  6  SMA<N>        sma;        // zero-alloc
  7  StdDev<N>     sd;
  8  double         k = 2.0;
  9
 10  constexpr auto on_bar(const Bar& b)
 11      // std::expected<Signal, Err> — C++23
 12      -> std::expected<Signal, Err> {
 13    auto mu  = sma.push(b.close);
 14    auto sig = sd.push(b.close);
 15    const auto upper = mu + k * sig;
 16    const auto lower = mu - k * sig;
 17    if (b.close > upper) return Signal::Long;
 18    if (b.close < lower) return Signal::Short;
 19    return Signal::Flat;
 20  }
 21};

Indicator latency · ns / bar · single core

measured · 10M bars · AMD 7950X
SMA<20>3ns
EMA<20>5ns
RSI<14>7ns
MACD11ns
Bollinger14ns
ATR<14>8ns
StdDev<20>6ns
138+
indicators
0 heap
allocs / hot path
10M/s
bars throughput
$ stratforge run --strat=bollinger --bars=10M→ 1.04s · 9.62M bars/s

Performance at a glance.

Definitive v1.0 benchmark tables drop with release. Engineering numbers below are measured on current dev builds.

Indicator latency
314ns
Per-bar incremental compute across the indicator library. Sub-cache-miss territory.
vs Python
TBD v1.0 release
Headline multiplier vs vectorbt / backtrader. Published with the v1.0 benchmark suite.
Built-in indicators
138+
Trend, momentum, volatility, volume, statistical. Header-only, composable, SIMD-friendly.
Heap allocations
0 / bar
Pre-allocated buffers, arena allocators. No GC, no jitter, no surprises.

Core capabilities.

Built for fast, reproducible quantitative research with modern C++ best practices, with the discipline to leave nothing on the heap.

Zero-allocation hot path.

Pre-allocated indicator buffers and arena allocators eliminate GC pauses. Consistent latency across millions of bars, predictable to the nanosecond.

0
heap allocs per bararena + ring-bufferp99 jitter < 40ns

138+ built-in indicators.

Header-only indicator library covering trend, momentum, volatility, volume, and statistical primitives. Composable templates, SIMD-friendly memory layout.

Production-ready reference strategies.

Dual MA, Bollinger Bands, MACD, Turtle, R-Breaker and more. Ship-shape implementations you can drop in, fork, or extend.

DualMABollingerMACDTurtleR-Breaker+12

Deterministic backtests.

Bit-exact reproducibility across runs. No hidden randomness, no platform drift. Same input, same output, across compilers, across machines.

SHA-256run_001 ≡ run_002cross-OS verified

Modern C++23.

std::expected for error handling, std::span for zero-copy views, concepts for compile-time validation, consteval lookup tables. The hot path, written in the language it deserves.

// compile-time validated
template<Indicator I>
auto compose(std::span<const Bar>) -> std::expected<R,E>;

Header-only API.

Drop-in include path. No build-system gymnastics, no link-time surprises. Compose indicators and strategies with template-driven generic code.

#include <stratforge.hpp>
// that's it. no CMake, no linker. just compile.

Why a modern engine
matters.

Python backtesters are research-grade tools. StratForge is what you reach for when you need the same results an HFT shop would get.

Python frameworksStratForge · C++23
Memory modelGC pauses, allocator jitter, opaque internals0 heap allocs on hot path · arena + ring buffers
Indicator throughputμs-per-bar · vectorize or wait3–14 ns per bar · incremental, branchless
Error handlingExceptions, silent NaN, "is it None?"std::expected · errors are values, not control flow
ReproducibilityRun-to-run drift from threads, dicts, libcBit-exact across compilers and OSes · SHA-equal output
Distributionpip + 14 native deps + venv archaeologyHeader-only · #include <stratforge.hpp> and compile
Python is where ideas are born. C++23 is where they're tested at the precision real money demands. StratForge keeps both worlds honest. Forge it once, run it everywhere.

How it works.

Three stages, one event loop. Each stage owns its memory and never reaches back across the boundary.

1 Stage 1 · Load & index

Bars in, columns aligned.

Bar data is loaded into pre-allocated columnar buffers and indexed for O(1) access by timestamp or position. No surprise copies, just std::span everywhere.

columnarmmapstd::spanO(1) seek
2 Stage 2 · Compute & evaluate

Indicators tick, strategy decides.

Indicators compute incrementally per bar. Strategy logic evaluates entries and exits against indicator state through branchless decision paths.

incrementalbranchlessSIMD-readyconsteval
3 Stage 3 · Report & persist

Trades and curves, streamed out.

Trades, equity curves, and performance metrics are streamed into pre-allocated report buffers and exported deterministically to Parquet, CSV, or your sink of choice.

ParquetCSVJSONdeterministic

Reference strategies, ready to fork.

Production-quality implementations of the classics. Drop one in, replace the parameters, ship.

▣ TREND

Dual Moving Average

◇ MEAN-REV

Bollinger Bands

∿ MOMENTUM

MACD

▲ BREAKOUT

Turtle

◬ INTRADAY

R-Breaker

Dive deeper.

Two threads to pull on next: the benchmark deep dive, or the live Q&A with the engine authors.

Get started with StratForge.

MIT licensed, header-only, and ready to drop into your existing C++ project. No build-system tax, no runtime dependencies. Just a header and a compiler that understands C++23.

MIT licensed header-only C++23 · clang ≥ 17 · gcc ≥ 13 Win · macOS · Linux

Explore other projects.

StratForge is one of three engines in the StratCraft suite. Same philosophy: open-source where possible, performance-first, no lock-in.