Actively developed

ta4j guide

ta4j brings TA-Lib-style indicators and a rule engine to Java and Kotlin projects.

Last reviewed

Quick answer

ta4j is an open-source Java library for technical analysis. You build a BarSeries, compose indicators and rules into a Strategy, and run it with BarSeriesManager to get trades and performance criteria. It is the standard choice for indicator logic on the JVM.

ta4j at a glance

Category
C#, Java & C++ frameworks
Language
Java
License
MIT
Does
Indicators, Backtesting
Markets
Stocks, Crypto, Forex, Futures
Best for
JVM trading systems that need indicators and simple backtests.
In AlgoGP
Use the exported strategy object from your own code

Pick it if

JVM trading systems that need indicators and simple backtests.

Watch out for

No broker connectivity built in.

ta4j strengths and limitations

Strengths

  • Composable rules and strategies.
  • Large indicator set.
  • Active maintenance.

Limitations

  • No broker connectivity built in.

ta4j example

Maven: org.ta4j:ta4j-core
Install
ClosePriceIndicator close = new ClosePriceIndicator(series);
SMAIndicator fast = new SMAIndicator(close, 50), slow = new SMAIndicator(close, 200);
Strategy strategy = new BaseStrategy(new CrossedUpIndicatorRule(fast, slow), new CrossedDownIndicatorRule(fast, slow));
TradingRecord record = new BarSeriesManager(series).run(strategy);
SMA crossover rule.

Use ta4j with AlgoGP

AlgoGP does not add ta4j to projects automatically yet, but nothing stops you using them together. Every AlgoGP project exports plain Python with a framework-neutral strategy object, so you can call it from ta4j yourself.

  1. 1

    Design and backtest in AlgoGP

    Describe the idea to the copilot and backtest it on AlgoGP’s normalized history.

  2. 2

    Add any bridge to get the adapter core

    Adding a bridged framework (for example Backtrader) writes frameworks/algogp_bridge.py, whose StrategyBridge.on_bar() returns the orders the strategy wants.

  3. 3

    Call it from ta4j

    Feed ta4j’s bars to StrategyBridge, place the returned orders with ta4j, and report fills back with sync().

ta4j: frequently asked questions

Does ta4j trade live?

It computes signals; connect them to a broker API yourself.

ta4j alternatives

Independent guide. AlgoGP is not affiliated with ta4j. Features, licenses and maintenance change; check the official documentation. Nothing here is investment advice.

Build a strategy