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 the building blocks to explore markets, validate trading ideas, and move from curiosity to production-grade automated systems — all without leaving the JVM.

Quick Start

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

Installation

Add ta4j to your Maven or Gradle project.

Core Concepts

Understand BarSeries, Indicators, Rules, and Strategies.

API Reference

Browse all 200+ indicators, rules, and analysis criteria.

What you can build

Backtest strategies

Test “what if” scenarios on years of historical data before risking real capital.

Paper trading bots

Run strategies live against market data without placing real orders.

Research tools

Analyze market patterns, compare indicators, and explore new trading ideas.

Automated trading systems

Deploy production bots that execute trades based on your strategies.

Get started

1

Add the dependency

Add ta4j-core to your pom.xml or build.gradle.
pom.xml
<dependency>
  <groupId>org.ta4j</groupId>
  <artifactId>ta4j-core</artifactId>
  <version>0.22.5</version>
</dependency>
2

Load price data

Create a BarSeries from your data source — CSV, Yahoo Finance, Coinbase, or your own broker API.
3

Build a strategy

Combine indicators and rules to define when to enter and exit trades.
ClosePriceIndicator close = new ClosePriceIndicator(series);
EMAIndicator fastEma = new EMAIndicator(close, 12);
EMAIndicator slowEma = new EMAIndicator(close, 26);
Rule entry = new CrossedUpIndicatorRule(fastEma, slowEma);
Rule exit  = new StopLossRule(close, 1.5);
Strategy strategy = new BaseStrategy("EMA Crossover", entry, exit);
4

Run the backtest

Execute your strategy and inspect the results.
TradingRecord record = new BarSeriesManager(series).run(strategy);
System.out.println("Trades: " + record.getTradeCount());

Explore the documentation

Data Sources

Yahoo Finance, Coinbase, CSV, and custom sources.

Performance Metrics

Sharpe ratio, drawdown, win rate, and 30+ more criteria.

Live Trading

Use the same strategy code for live execution.

Charting

Visualize strategies with candlestick charts and indicator overlays.

Serialization

Save and restore strategies and indicators as JSON.

Elliott Wave

Advanced wave analysis with confidence scoring.