Quant Methods Overview
The prebuilt strategy library. TSMomentum, BollingerMeanRev, MovingAverageCross, RSIMeanRev, Ensemble
Horizon ships a tested library of classical quant strategies. Each is a real Strategy subclass with real feature computation, real signal emission, and real backtest coverage. Drop them straight into hz.run(strategies=[...]) or subclass them to extend.
At a glance
Style: trend-following Best in: persistent trends Inputs: Return, RealizedVol
Style: mean reversion Best in: range-bound / chop Inputs: BollingerZ, RealizedVol
Style: trend-following Best in: persistent directional moves Inputs: MovingAverageCross, RealizedVol
Style: mean reversion Best in: range-bound Inputs: RSI, RealizedVol
Style: meta-strategy Best in: diversification across regimes Inputs: wraps any Strategy subclasses
Quick comparison
| Strategy | Signal type | Regime fit | Turnover | Drawdown profile |
|---|---|---|---|---|
TSMomentum | Trend | Trending | Medium | Slow pullbacks |
BollingerMeanRev | Mean reversion | Range / chop | High | Frequent small losses |
MovingAverageCross | Trend | Trending | Low | Whipsaws in chop |
RSIMeanRev | Mean reversion | Range | Medium-high | Extreme hits costly |
Ensemble(all) | Mixed | All regimes | Combined | Diversified |
Importing them
from horizon.quant import (
TSMomentum,
BollingerMeanRev,
MovingAverageCrossStrategy,
RSIMeanRev,
Ensemble,
)
Using them in a backtest
import horizon as hz
from horizon.asset_classes import AssetClass, Equity
from horizon.data import SyntheticGBM
from horizon.discovery import StaticUniverse
from horizon.discovery.base import Market
from horizon.portfolio import KellyOptimizer
from horizon.quant import BollingerMeanRev, TSMomentum
from horizon.risk import RiskProfile
result = hz.run(
mode="backtest",
strategies=[
TSMomentum(lookback=20, edge_bps=60),
BollingerMeanRev(window=20, entry_z=2.0, edge_bps=50),
],
asset_classes=[Equity],
universe=StaticUniverse([
Market(id=t, asset_class=AssetClass.Equity)
for t in ["AAPL", "MSFT", "NVDA"]
]),
portfolio=KellyOptimizer(kelly_fraction=0.20),
risk=RiskProfile.moderate(),
data_source=SyntheticGBM(["AAPL", "MSFT", "NVDA"], n_bars=252, seed=42),
backtest=hz.BacktestConfig(initial_cash_usd=100_000),
)
Multiple strategies deposit signals into the same SignalStore; the portfolio optimizer sees the combined list and allocates capital across all of them.
Picking the right one
Subclassing
Every prebuilt is a normal Python class. You can subclass any of them to customize:
from horizon.quant import TSMomentum
from horizon.types import Signal
class MyMomentum(TSMomentum):
"""TSMomentum with a volatility filter."""
def evaluate(self, f, universe):
# Only trade when realized vol is elevated
return [
sig for sig in super().evaluate(f, universe)
if f.vol[sig.market_id] > 0.15
]
All prebuilts use the real feature library
See Features for what each input computes.
Verified behavior
Every prebuilt is covered by tests/test_backtest_integration.py::TestQuantLibrary:
@pytest.mark.parametrize("strat_fn", [
lambda: TSMomentum(lookback=10),
lambda: BollingerMeanRev(window=15, entry_z=1.5),
lambda: MovingAverageCrossStrategy(fast=5, slow=20),
lambda: RSIMeanRev(window=10),
])
def test_each_strategy_runs(self, strat_fn) -> None:
result = hz.run(
mode="backtest",
strategies=[strat_fn()],
...,
)
assert result is not None
assert len(result.equity_curve) == 100
assert result.equity_curve[0][1] == 100_000.0
Every strategy runs end-to-end on synthetic data without errors. The full 163-test suite includes these as integration tests.