Skip to main content
ta4j is published to Maven Central. No additional repository configuration is required for stable releases.

Requirements

  • JDK 21 or later. ta4j requires Java 21+. The build enforces this via the Maven Enforcer plugin. Check your installed version with java -version.
  • Maven 3.9+ or Gradle 8+. Either build tool works.

Add ta4j-core

ta4j-core is the main library. It contains all indicators, rules, strategies, the backtesting engine, and analysis criteria.
<dependency>
  <groupId>org.ta4j</groupId>
  <artifactId>ta4j-core</artifactId>
  <version>0.22.5</version>
</dependency>

Optional: ta4j-examples

ta4j-examples is a companion module that provides:
  • Data loadersYahooFinanceHttpBarSeriesDataSource, CoinbaseHttpBarSeriesDataSource, CsvFileBarSeriesDataSource, and JsonFileBarSeriesDataSource, all implementing the unified BarSeriesDataSource interface.
  • Charting utilitiesChartWorkflow for building candlestick charts with indicator overlays and performance subcharts using JFreeChart.
  • Runnable demos — Complete, well-commented examples covering backtesting, multi-strategy comparison, live trading patterns, and Elliott Wave analysis.
<dependency>
  <groupId>org.ta4j</groupId>
  <artifactId>ta4j-examples</artifactId>
  <version>0.22.5</version>
</dependency>

Snapshot builds

Every push to the master branch publishes a snapshot to Sonatype’s snapshot repository. Snapshots contain the latest merged changes and are useful for testing upcoming features before a stable release.
Snapshot builds are not guaranteed to be stable. APIs may change between snapshots and the published stable release. Do not use snapshots in production.
Add the snapshot repository and use the snapshot version:
<repositories>
  <repository>
    <id>central-portal-snapshots</id>
    <url>https://central.sonatype.com/repository/maven-snapshots/</url>
    <snapshots>
      <enabled>true</enabled>
    </snapshots>
  </repository>
</repositories>

<dependencies>
  <dependency>
    <groupId>org.ta4j</groupId>
    <artifactId>ta4j-core</artifactId>
    <version>0.22.6-SNAPSHOT</version>
  </dependency>
</dependencies>

Build from source

Building from source gives you the very latest code, including any changes not yet published as a snapshot.
# Clone the repository
git clone https://github.com/ta4j/ta4j.git
cd ta4j

# Build and install to your local Maven repository
# Linux / macOS / Git Bash
./mvnw clean install -DskipTests

# Windows CMD / PowerShell
mvnw.cmd clean install -DskipTests
After the build completes, the 0.22.6-SNAPSHOT artifacts are available in your local ~/.m2/repository. Reference them the same way as any other dependency.
The build uses the Maven Wrapper (mvnw), which downloads and uses the exact Maven version pinned in .mvn/wrapper/maven-wrapper.properties. You do not need a global Maven installation, though you can substitute mvn if you prefer your local installation.
To run all tests as part of the build (takes longer but recommended before contributing):
./mvnw clean install

Verify the installation

Once you have added the dependency, confirm it resolves correctly by creating a minimal class:
import org.ta4j.core.BarSeries;
import org.ta4j.core.builder.BaseBarSeriesBuilder;

public class VerifyInstall {
    public static void main(String[] args) {
        BarSeries series = new BaseBarSeriesBuilder().withName("test").build();
        System.out.println("ta4j installed correctly. Bar count: " + series.getBarCount());
    }
}
If this compiles and prints ta4j installed correctly. Bar count: 0, your setup is working.

Next steps

Quick Start

Build your first strategy and run a complete backtest.

Data sources

Load market data from Yahoo Finance, Coinbase, CSV, or your own source.