Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ta4j/ta4j/llms.txt

Use this file to discover all available pages before exploring further.

ta4j is a Java library for technical analysis. It gives you everything you need to explore markets, validate trading ideas, and deploy production-grade automated systems — all without leaving the JVM. Whether you are building a simple moving average crossover or a multi-indicator strategy running on live crypto feeds, ta4j provides the building blocks.

What ta4j does

ta4j has four core capabilities that work together: Indicators — calculate values from OHLCV price data. ta4j ships with 200+ ready-to-use indicators: trend-following (EMA, SMA, Ichimoku, MACD), momentum (RSI, CCI, Stochastic), volatility (ATR, Bollinger Bands, Keltner Channels), volume (VWAP, MFI, OBV), and candlestick pattern recognition (Morning Star, Engulfing, Harami, and dozens more). Indicators compose: pass the output of one as the input to another. Rules and strategies — express entry and exit conditions in plain Java. Rules are boolean predicates (CrossedUpIndicatorRule, OverIndicatorRule, StopLossRule, and so on). Combine them with .and(), .or(), and .xor() to build a complete Strategy without any DSL or configuration files. Backtesting — run your strategy against years of historical bars in seconds with BarSeriesManager. Apply realistic trading costs via LinearTransactionCostModel, model slippage with SlippageExecutionModel, and evaluate results with 30+ analysis criteria. Live trading — the same strategy code that runs a backtest also drives live execution. Add new bars to a BarSeries as they arrive, call strategy.shouldEnter(index) and strategy.shouldExit(index), and route the signals to your broker or exchange.

What you can build

Backtest trading strategies

Test “what if” scenarios on years of historical data before risking real capital. Vary indicator parameters, compare results, and find the parameter sets that hold up under scrutiny.

Paper trading bots

Run a live strategy against real market data without placing real orders. Validate signal quality and execution logic end-to-end in a zero-risk environment.

Research tools

Analyze market patterns, compare hundreds of indicator combinations, and build reproducible experiments. ta4j’s deterministic calculations mean the same input always produces the same output.

Automated trading systems

Deploy production bots that ingest live bars, evaluate strategy signals, and submit orders. The JVM gives you low-latency and reliable concurrency without Python’s multiprocessing overhead.

Why Java developers choose ta4j

Pure Java, zero friction. ta4j works anywhere Java 21+ runs — cloud functions, desktop tools, microservices, containerized bots. No Python bridges, no native extensions, no external runtime dependencies. Performance advantage over Python. Native multi-threading lets ta4j saturate every CPU core with no GIL bottleneck. Backtest hundreds of strategies in parallel, process years of tick data in seconds, and run parameter sweeps that would be impractical in single-threaded Python environments. Type-safe, production-ready API. Strong typing and explicit models make strategies easier to reason about and harder to misuse. Compile-time checks catch configuration errors before they cost money. Strategies and indicators serialize to JSON for persistence, sharing, and integration with other systems. Composable by design. Indicators, rules, and strategies are small, focused objects. Chain them together with familiar Java patterns — no framework magic, no annotation processing, no hidden state. MIT licensed. Use ta4j in commercial products, research projects, or open-source work without legal concerns.

Core concepts at a glance

ConceptClassDescription
Price dataBarSeriesA time-ordered sequence of OHLCV bars
CalculationIndicator<T>Computes a value for each bar index
ConditionRuleA boolean predicate over indicator values
SystemStrategyEntry rule + exit rule
SimulationBarSeriesManagerRuns a strategy over a BarSeries
ResultsTradingRecordAll trades executed during a backtest or live session

Get started

Quick Start

Build your first EMA crossover strategy and run a complete backtest in under 5 minutes.

Installation

Add ta4j-core to your Maven or Gradle project and configure snapshot builds.

Core concepts

Learn how BarSeries, Indicators, Rules, and Strategies fit together.

API reference

Browse all 200+ indicators, rules, and analysis criteria with usage examples.