Ta4j Wiki

Documentation, examples and further information of the ta4j project

View the Wiki On GitHub

This project is maintained by ta4j Organization

Technical Indicators

Technical indicators (a.k.a. technicals) transform price/volume data into structured signals that power rules and strategies. ta4j ships with 130+ indicators covering every major category plus building blocks for your own creations.

Category Highlights Docs
Trend / Moving Averages SMA, EMA, HMA, VIDYA, Jurik, Displaced variants, SuperTrend, Renko helpers. Moving Average Indicators
Momentum & Oscillators RSI family, NetMomentum (new), MACD/MACDV, KST, Stochastics, Calm (CMO), ROC. This page
Volatility & Bands ATR, Donchian, Bollinger, Keltner, Average True Range trailing stops. Bar Series & Bars (for ATR-based stops)
Volume & Breadth OBV, VWAP/VWMA, Accumulation/Distribution, Chaikin, Volume spikes. Indicators package
Candle/Pattern Hammer, Shooting Star, Three White Soldiers, DownTrend/UpTrend. indicators.candles
Price Transformations RenkoUp/Down/X (0.19), Heikin Ashi builders, BinaryOperationIndicator/UnaryOperationIndicator transforms. indicators.renko

Browse org.ta4j.core.indicators in your IDE for the full list—packages mirror the table above.

Composition example

ClosePriceIndicator close = new ClosePriceIndicator(series);
SMAIndicator fast = new SMAIndicator(close, 9);
SMAIndicator slow = new SMAIndicator(close, 50);
MACDVIndicator macdv = new MACDVIndicator(series, 12, 26, 9);
NetMomentumIndicator netMomentum = new NetMomentumIndicator(series, 14);

Indicator<Num> trendBias = BinaryOperationIndicator.division(fast, slow);
Indicator<Num> blendedMomentum = BinaryOperationIndicator.add(macdv.getMacd(), netMomentum);

Backtesting indicators

Indicators should be evaluated the same way strategies are—prefer realistic data with survivorship-bias filters. The Usage Examples page links to CSV/Chart demos where indicators are plotted alongside price bars.

Caching & stability

Creating custom indicators

Sub-class CachedIndicator<Num> or compose existing indicators with operations. Guidelines:

Tips

Visualizing indicators

You can visualize indicators on charts using the ChartBuilder API. Indicators can be displayed as overlays on price charts or as separate sub-charts:

ClosePriceIndicator closePrice = new ClosePriceIndicator(series);
SMAIndicator sma = new SMAIndicator(closePrice, 50);

ChartWorkflow chartWorkflow = new ChartWorkflow();
chartWorkflow.builder()
    .withSeries(series)
    .withIndicatorOverlay(sma)
    .withLineColor(Color.ORANGE)
    .display();

Caching mechanism

Some indicators need recursive calls and/or values from the previous bars in order to calculate their last value. For that reason, a caching mechanism has been implemented for all the indicators provided by ta4j. This system avoids calculating the same value twice. Therefore, if a value has been already calculated it is retrieved from cache the next time it is requested. Values for the last Bar will not be cached. This allows you to modify the last bar of the BarSeries by adding price/trades to it and to recalculate results with indicators.

Warning! If a maximum bar count has been set for the related bar Series, then the results calculated for evicted bars are evicted too. They also cannot be recomputed since the related bars have been removed. That being said, moving bar Series should not be used when you need to access long-term past bars.