Releases: ta4j/ta4j
0.21.0
Changed
-
Unified return representation system: Say goodbye to inconsistent return formats across your analysis! Return-based criteria now use a unified
ReturnRepresentationsystem that lets you choose how returns are displayedβwhether you prefer multiplicative (1.12 for +12%), decimal (0.12), percentage (12.0), or logarithmic formats. Set it once globally viaReturnRepresentationPolicyor customize per-criterion. No more mental math converting between formatsβTa4j handles it all automatically. LegacyaddBaseconstructors are deprecated in favor of the more expressiveReturnRepresentationenum. -
Ratio criteria now speak your language: All ratio-producing criteria now support
ReturnRepresentation, so you can format outputs consistently across your entire analysis pipeline. Whether you're comparing strategies, measuring risk, or tracking performance metrics, everything uses the same format. Updated criteria include:VersusEnterAndHoldCriterion: Strategy vs. buy-and-hold comparison (e.g., 0.5 = 50% better, displayed as 0.5, 50.0, or 1.5 depending on your preference)ReturnOverMaxDrawdownCriterion: Reward-to-risk ratio (e.g., 2.0 = return is 2x drawdown)PositionsRatioCriterion: Win/loss percentage (e.g., 0.5 = 50% winning)InPositionPercentageCriterion: Time in market (e.g., 0.5 = 50% of time)CommissionsImpactPercentageCriterion: Trading cost impact (e.g., 0.05 = 5% impact)AbstractProfitLossRatioCriterion(and subclasses): Profit-to-loss ratio (e.g., 2.0 = profit is 2x loss)
All ratio criteria default to
ReturnRepresentation.DECIMAL(the conventional format for ratios), but you can override per-criterion or globally. Perfect for dashboards, reports, or when you need to match external data formats. See each criterion's javadoc for detailed examples. -
Improved return representation tooling: Added factory-level exponential support to avoid premature double conversions, expanded representation parsing to accept flexible names, and aligned VaR/ES/average-return empty-record behaviour across representations.
-
High-precision DecimalNum exponentials:
DecimalNumFactory#expnow evaluates exponentials using the configuredMathContextinstead of delegating to {@code Math.exp}, preventing accidental loss of precision for high-precision numeric workflows. -
Simplified Returns class implementation: Removed unnecessary
formatOnAccesscomplexity fromReturnsclass, inlined trivialformatReturn()wrapper method, and improved documentation clarity. The class now has a cleaner separation of concerns with better cross-references betweenReturns,ReturnRepresentation, andReturnRepresentationPolicy.
Breaking
- EMA indicators now return NaN during unstable period:
EMAIndicator,MMAIndicator, and all indicators extendingAbstractEMAIndicatornow returnNaNfor indices within the unstable period (indices <beginIndex + getCountOfUnstableBars()). Previously, these indicators would return calculated values during the unstable period. Action required: Update any code that accesses EMA indicator values during the unstable period to handleNaNvalues appropriately, or wait until after the unstable period before reading values. DifferencePercentageIndicatordeprecated:DifferencePercentageIndicatorhas been deprecated in favor ofPercentageChangeIndicator, which now provides all the same functionality plus additional features. Action required: Migrate toPercentageChangeIndicatorusing the migration examples in the deprecation javadoc.
Added
- Added
TrueStrengthIndexIndicator,SchaffTrendCycleIndicator, andConnorsRSIIndicatorto expand oscillator coverage - Added
PercentRankIndicatorhelper indicator to calculate the percentile rank of a value within a rolling window - Added
DifferenceIndicatorhelper indicator to calculate the difference between current and previous indicator values - Added
StreakIndicatorhelper indicator to track consecutive up or down movements in indicator values - Added
StochasticIndicatoras a generic stochastic calculation indicator, extracted fromSchaffTrendCycleIndicatorfor reuse - AI-powered semantic release scheduler: Added automated GitHub workflow that uses AI to analyze changes, determine version bumps (patch/minor/major), and schedule releases every 14 days. Includes structured approval process for major version bumps and OIDC token-based authentication for AI model calls. Enhanced release workflows with improved error handling, tag checking, and logging.
0.19
0.19 (released November 19, 2025)
Breaking
TradingStatementis now an interface: Converted to an interface implemented byBaseTradingStatement. This exposes the underlyingStrategyandTradingRecordfor advanced analysis workflows. Action required: Update any code that directly instantiatesTradingStatementto useBaseTradingStatementinstead.- PnL and return criteria refactored into net/gross variants: Split
ProfitLossCriterion,ProfitCriterion,LossCriterion,AverageProfitCriterion,AverageLossCriterion,ReturnCriterion,ProfitLossRatioCriterion, andProfitLossPercentageCriterioninto separate net and gross concrete classes. This provides explicit control over whether trading costs are included in calculations. Action required: Update imports and class names to use the appropriate net or gross variant based on your analysis needs. - Indicator operation classes consolidated: #1266 Unified
BinaryOperation,UnaryOperation,TransformIndicator, andCombineIndicatorinto a cleaner API. Action required: Replace deprecatedTransformIndicatorandCombineIndicatorusage with the new consolidated classes. - Drawdown criteria moved to sub-package: Relocated
MaximumDrawdownCriterionandReturnOverMaxDrawdownCriterionto thecriteria/drawdown/sub-package for better organization. Action required: Update import statements to reflect the new package location.
Added
- Rule naming support: Added
Rule#getName()andRule#setName(String)methods to allow rules to have custom names for improved trace logging and serialization. Rules now default to JSON-formatted names that include type and component information, but can be overridden with custom labels for better readability in logs and debugging output. - Time-based trading rules: Added
HourOfDayRuleandMinuteOfHourRuleto enable trading strategies based on specific hours of the day (0-23) or minutes of the hour (0-59). These rules work withDateTimeIndicatorto filter trading signals by time, enabling time-of-day based strategies. - Time-based strategy examples: Added
HourOfDayStrategyandMinuteOfHourStrategyas example implementations demonstrating how to use the new time-based rules in complete trading strategies. - Enhanced backtesting with performance tracking: Introduced
BacktestExecutionResultandBacktestRuntimeReportwith newBacktestExecutorentry points. Users can now track per-strategy execution times, receive progress callbacks during long-running backtests, and efficiently stream top-k strategy selection for large strategy grids without loading all results into memory. - Strategy serialization for persistence: Added
StrategySerializationwithStrategy#toJson()andStrategy#fromJson(BarSeries, String)methods. This enables users to save and restore complete strategy configurations (including entry/exit rules) as JSON, making it easy to share strategies, version control configurations, and build strategy libraries. - NamedStrategy serialization with compact format: #1349 Enabled
NamedStrategyserialization/deserialization with compact labels (e.g.,ToggleNamedStrategy_true_false_u3). Users can now persist strategy presets alongside their parameters in a human-readable format. Added registry/permutation helper APIs and lazy package scanning viaNamedStrategy.initializeRegistry(...)for efficient strategy discovery. - Renko chart indicators: #1187 Added
RenkoUpIndicator,RenkoDownIndicator, andRenkoXIndicatorto detect Renko brick sequences, enabling users to build strategies based on Renko chart patterns. - Advanced drawdown analysis: Added
CumulativePnL,MaximumAbsoluteDrawdownCriterion,MaximumDrawdownBarLengthCriterion, andMonteCarloMaximumDrawdownCriterion. Users can now analyze drawdowns in absolute terms, measure drawdown duration, and estimate drawdown risk distributions through Monte Carlo simulation of different trade orderings. - Comprehensive commission tracking: Added
CommissionsCriterionto total commissions paid across positions andCommissionsImpactPercentageCriterionto measure how much trading costs reduce gross profit. This helps users understand the real impact of transaction costs on strategy performance. - Streak and extreme position analysis: Added
MaxConsecutiveLossCriterion,MaxConsecutiveProfitCriterion,MaxPositionNetLossCriterion, andMaxPositionNetProfitCriterion. Users can now identify worst loss streaks, best win streaks, and extreme per-position outcomes to better understand strategy risk and consistency. - Position timing analysis: Added
InPositionPercentageCriterionto calculate the percentage of time a strategy remains invested, helping users understand capital utilization and exposure. - Flexible bar building options: Added
AmountBarBuilderto aggregate bars after a fixed number of amount have been traded. Bars can now be built bybeginTimeinstead ofendTime, providing more flexibility in bar aggregation strategies. - Volume-weighted MACD: Added
MACDVIndicatorto volume-weight MACD calculations, providing an alternative MACD variant that incorporates volume information. - Net momentum indicator: Added
NetMomentumIndicatorfor momentum-based strategy development. - Vote-based rule composition: Added
VoteRuleclass, enabling users to create rules that trigger based on majority voting from multiple underlying rules. - Enhanced data loading: Added
AdaptiveJsonBarsSerializerto support OHLC bar data from Coinbase or Binance, and newJsonBarsSerializer.loadSeries(InputStream)overload for easier data loading from streams. - Improved charting and examples: Expanded charting utilities to overlay indicators with trading records, added
NetMomentumStrategyandTopStrategiesExample, and bundled a Coinbase ETH/USD sample data set to demonstrate the new APIs. - Automated release pipeline: Added GitHub workflow to automatically version, build, and publish artifacts to Maven Central. The pipeline uses
prepare-release.shto prepare release versions, creates release branches and tags, and publishes to Maven Central. Addedscripts/tests/test_prepare_release.shto validate release preparation functionality. - Enhanced performance reporting: Added Gson
DurationTypeAdapter,BasePerformanceReport, and revisedTradingStatementGeneratorso generated statements always carry their source strategy and trading record for complete traceability. - UnaryOperation helper: Added
substitutehelper function toUnaryOperationfor easier indicator transformations. - Testing infrastructure: Added tests for
DoubleNumFactoryandDecimalNumFactory, unit tests around indicator concurrency in preparation for future multithreading features, andDecimalNumPrecisionPerformanceTestto demonstrate precision vs performance trade-offs.
Changed
- Enhanced rule serialization with custom name preservation: Improved
RuleSerializationto preserve custom rule names set viasetName()during serialization and deserialization. Custom names are now properly distinguished from default JSON-formatted names, enabling better strategy persistence and debugging workflows. - Improved trace logging with rule names: Enhanced trace logging in
AbstractRuleandBaseStrategyto use rule names (custom or default) in log output, making it easier to identify which rules are being evaluated during strategy execution. - Unified logging backend: Replaced Logback bindings with Log4j 2
log4j-slf4j2-implso examples and tests share a single logging backend. Added Log4j 2 configurations for modules and tests. This simplifies logging configuration and ensures consistent behavior across all modules. Set unit test logging level to INFO and cleaned build output of all extraneous logging. - More accurate return calculations: Changed
AverageReturnPerBarCriterion,EnterAndHoldCriterion, andReturnOverMaxDrawdownCriterionto useNetReturnCriterioninstead ofGrossReturnCriterionto avoid optimistic bias. This provides more realistic performance metrics that account for trading costs. - Improved drawdown criterion behavior:
ReturnOverMaxDrawdownCriterionnow returns 0 instead ofNaNfor strategies that never operate, and returns net profit instead ofNaNfor strategies with no drawdown. This makes the criterion more robust and easier to use in automated analysis. - More flexible stop rules:
StopGainRuleandStopLossRulenow accept any priceIndicatorinstead of onlyClosePriceIndicator. Users can now create stop rules based on high, low, open, or custom price indicators for more sophisticated exit strategies. - Enhanced swing indicators: Reworked
RecentSwingHighIndicatorandRecentSwingLowIndicatorwith plateau-aware, NaN-safe logic and exposedgetLatestSwingIndexfor downstream analysis. This improves reliability and enables more advanced swing-based strategies. - Configurable numeric precision: Reduced default
DecimalNumprecision from 32 to 16 digits, improving performance while still maintaining sufficient accuracy for most use cases. Users can configure precision based on their specific needs. - Improved numeric indicator chaining:
NumericIndicator'spreviousmethod now returns aNumericIndicator, enabling fluent method chaining for indicator composition. - Enhanced trading statements: Added
TradingRecordproperty toTradingStatementfor more downstream flexibility around analytics, enabling users to access the full trading record from performance reports. - Better code maintainability: Removed magic number 25 in
UpTrendIndicatorandDownTrendIndicator, making the...
Release 0.18
What's Changed
Breaking
- Updated project Java JDK from 11 > 21
- Updated Github workflows to use JDK 21
- Extracted NumFactory as source of numbers with defined precision
- Replaced
ZonedDateTimewithInstant - Renamed
FixedDecimalIndicatorwithFixedNumIndicator - Moved
BaseBarBuilderandBaseBarBuilderFactorytobars-package and renamed toTimeBarBuilderandTimeBarBuilderFactory - Renamed
BaseBarConvertibleBuilderTesttoBaseBarSeriesBuilderTest - Renamed
Indicator.getUnstableBarstoIndicator.getCountOfUnstableBars - Moved
indicators/AbstractEMAIndicatortoindicators/averages-package - Moved
indicators/DoubleEMAIndicatortoindicators/averages-package - Moved
indicators/EMAIndicatortoindicators/averages-package - Moved
indicators/HMAIndicatortoindicators/averages-package - Moved
indicators/KAMAIndicatortoindicators/averages-package - Moved
indicators/LWMAIndicatortoindicators/averages-package - Moved
indicators/MMAIndicatortoindicators/averages-package - Moved
indicators/SMAIndicatortoindicators/averages-package - Moved
indicators/TripleEMAIndicatortoindicators/averages-package - Moved
indicators/WMAIndicatortoindicators/averages-package - Moved
indicators/ZLEMAIndicatortoindicators/averages-package - Implemented sharing of
MathContextinDecimalNum. For creating numbers,NumFactoryimplementations are the preferred way.
Fixed
- Fixed
BaseBar.toString()to avoidNullPointerExceptionif any of its property is null - Fixed
SMAIndicatorTestto set the endTime of the next bar correctly - Fixed
SMAIndicatorMovingSeriesTestto set the endTime of the next bar correctly - Use UTC TimeZone for
AroonOscillatorIndicatorTest,PivotPointIndicatorTest - Fixed
MockBarBuilderto useInstant.nowfor beginTime - Fixed
RecentSwingHighIndicatorTestto create bars consistently - Fixed
LSMAIndicatorto fix lsma calculation for incorrect values
Changed
- Updated jfreechart dependency in ta4j-examples project from 1.5.3 to 1.5.5 to resolve CVE-2023-52070
- Updated logback-classic 1.4.12 > 1.5.6 to resolve CVE-2023-6481
- Cleaned code by using new java syntax
text blocks - Faster test execution by using
String.lines()instead ofStringconcatenation - Improve Javadoc for
DecimalNumandDoubleNum - Allowed JUnit5 for new tests. Old remain as is.
Added
- added
HeikinAshiBarAggregator: Heikin-Ashi bar aggregator implementation - added
HeikinAshiBarBuilder: Heikin-Ashi bar builder implementation - added
Bar.getZonedBeginTime: the bar's begin time usable as ZonedDateTime - added
Bar.getZonedEndTime: the bar's end time usable as ZonedDateTime - added
Bar.getSystemZonedBeginTime: the bar's begin time converted to system time zone - added
Bar.getSystemZonedEndTime: the bar's end time converted to system time zone - added
BarSeries.getSeriesPeriodDescriptionInSystemTimeZone: with times printed in system's default time zone - added
KRIIndicator - Added constructor with
amountforEnterAndHoldCriterion - Added constructor with
amountforVersusEnterAndHoldCriterion - Added
TickBarBuildertobars-package to aggregate bars after a fixed number of ticks - Added
VolumeBarBuildertobars-package to aggregate bars after a fixed number of contracts (volume) - Added
TickBarBuildertobars-package - Added
VolumeBarBuildertobars-package - Added
Indicator.isStable: istrueif the indicator no longer produces incorrect values due to insufficient data - Added
WildersMAIndicatortoindicators.averages-package: Wilder's moving average indicator - Added
DMAIndicatortoindicators.averages-package: Displaced Moving Average (DMA) indicator - Added
EDMAIndicatortoindicators.averages-package: Exponential Displaced Moving Average (EDMA) indicator - Added
JMAIndicatortoindicators.averages-package: Jurik Moving Average (JMA) indicator - Added
TMAIndicatortoindicators.averages-package: Trangular Moving Average (TMA) indicator - Added
ATMAIndicatortoindicators.averages-package: Asymmetric Trangular Moving Average (TMA) indicator - Added
MCGinleyMAIndicatortoindicators.averages-package: McGinley Moving Average (McGinleyMA) indicator - Added
SMMAIndicatortoindicators.averages-package: Smoothed Moving Average (SMMA) indicator - Added
SGMAIndicatortoindicators.averages-package: Savitzky-Golay Moving Average (SGMA) indicator - Added
LSMAIndicatortoindicators.averages-package: Least Squares Moving Average (LSMA) indicator - Added
KiJunV2Indicatortoindicators.averages-package: Kihon Moving Average (KiJunV2) indicator - Added
VIDYAIndicatortoindicators.averages-package: Chandeβs Variable Index Dynamic Moving Average (VIDYA) indicator - Added
VWMAIndicatortoindicators.averages-package: Volume Weighted Moving Average (VWMA) indicator - added
AverageIndicator
New Contributors
- @algonell made their first contribution in #1184
- @ek-ex made their first contribution in #1232
- @brhurley made their first contribution in #1226
Full Changelog: 0.17...0.18
Release 0.17
Release 0.17 of the Ta4j library.
This is the fourth release via GitHub Releases. Ta4j is also available on the maven central repository
Changelog for ta4j, roughly following keepachangelog.com from version 0.9 onwards.
What's Changed
- Implemented partial sum cache for SMAIndicator by @sgflt in #1140
- Added signal line and histogram to MACDIndicator by @sgflt in #1155
- Update README.md by @TheCookieLab in #1156
- Update ProfitLossCriterion.java by @ts-00 in #1158
- Tradingrecord getters by @ts-00 in #1160
- Use
Predicateinstead of enum inBooleanTransformIndicatorby @Petersoj in #1163 - Update ta4jexamples dependency version and fix SMAIndicatorMovingSerieTest by @TheCookieLab in #1166
- Add
EnterAndHoldCriterionby @nimo23 in #1105 - add-Num#bigDecimalValue by @nimo23 in #1109
- Feature/recent swing high and low indicators by @TheCookieLab in #1125
- Feature/ttmsqueezepro indicator by @TheCookieLab in #1168
- Feature/1169 atr based stop loss rules by @TheCookieLab in #1170
- implemented kalman filter indicator for smoothing by @TheCookieLab in #1172
- Candle indicators by @btezergil in #1174
- RecentSwing*Indicator fixed look ahead bias by @TheCookieLab in #1173
- reused tr in constructor instead of creating new instance by @TheCookieLab in #1176
New Contributors
- @sgflt made their first contribution in #1140
- @ts-00 made their first contribution in #1158
- @btezergil made their first contribution in #1174
Full Changelog: 0.16...0.17
Release 0.16
Release 0.16 of the Ta4j library.
This is the third release via GitHub Releases. Ta4j is also available on the maven central repository
Changelog for ta4j, roughly following keepachangelog.com from version 0.9 onwards.
0.16 (released May 15, 2024)
Breaking
- Upgraded to Java 11
- VersusBuyAndHoldCriterion renamed to
VersusEnterAndHoldCriterion - BarSeries constructors use any instance of Num instead of Num-Function
- GrossReturnCriterion renamed to
ReturnCriterion - NetProfitCriterion and GrossProfitCriterion replaced by
ProfitCriterion - NetLossCriterion and GrossLossCriterion replaced by
LossCriterion - LosingPositionsRatioCriterion replaced by
PositionsRatioCriterion - WinningPositionsRatioCriterion replaced by
PositionsRatioCriterion - Strategy#unstablePeriod renamed to
Strategy#unstableBars* - DateTimeIndicator moved to package
indicators/helpers - UnstableIndicator moved to package
indicators/helpers - ConvertableBaseBarBuilder renamed to
BaseBarConvertableBuilder - BarSeriesManager updated to use
TradeOnNextOpenModelby default, which opens new trades at indext + 1at the open price.- For strategies require the previous behaviour, i.e. trades seconds or minutes before the closing prices,
TradeOnCurerentCloseModelcan be passed to BarSeriesManager- For example:
BarSeriesManager manager = new BarSeriesManager(barSeries, new TradeOnCurrentCloseModel())BarSeriesManager manager = new BarSeriesManager(barSeries, transactionCostModel, holdingCostModel, tradeExecutionModel)
- For example:
- For strategies require the previous behaviour, i.e. trades seconds or minutes before the closing prices,
- BarSeriesManager and BacktestExecutor moved to packge
backtest - BarSeries#getBeginIndex() methode returns correct begin index for bar series with max bar count
Fixed
- Fixed SuperTrendIndicator fixed calculation when close price is the same as the previous Super Trend indicator value
- Fixed ParabolicSarIndicator fixed calculation for sporadic indices
- ExpectancyCriterion fixed calculation
- catch NumberFormatException if
DecimalNum.valueOf(Number)isNaN - ProfitCriterion fixed excludeCosts functionality as it was reversed
- LossCriterion fixed excludeCosts functionality as it was reversed
- PerformanceReportGenerator fixed netProfit and netLoss calculations to include costs
- DifferencePercentageIndicator fixed re-calculate instance variable on every iteration
- ThreeWhiteSoldiersIndicator fixed eliminated instance variable holding possible wrong value
- ThreeBlackCrowsIndicator fixed eliminated instance variable holding possible wrong value
- TrailingStopLossRule removed instance variable
currentStopLossLimitActivationbecause it may not be alway the correct (last) value - sets
ClosePriceDifferenceIndicator#getUnstableBars=1 - sets
ClosePriceRatioIndicator#getUnstableBars=1 - sets
ConvergenceDivergenceIndicator#getUnstableBars=barCount - sets
GainIndicator#getUnstableBars=1 - sets
HighestValueIndicator#getUnstableBars=barCount - sets
LossIndicator#getUnstableBars=1 - sets
LowestValueIndicator#getUnstableBars=barCount - sets
TRIndicator#getUnstableBars=1 - sets
PreviousValueIndicator#getUnstableBars=n(= the n-th previous index) - PreviousValueIndicator returns
NaNif the (n-th) previous value of an indicator does not exist, i.e. if the (n-th) previous is below the first available index. - EnterAndHoldReturnCriterion fixes exception thrown when bar series was empty
- BaseBarSeries fixed
UnsupportedOperationExceptionwhen creating a bar series that is based on an unmodifiable collection - Num implements Serializable
Changed
- BarSeriesManager consider finishIndex when running backtest
- BarSeriesManager add
holdingTransaction - BacktestExecutor evaluates strategies in parallel when possible
- CachedIndicator synchronize on getValue()
- BaseBar defaults to
DecimalNumtype in all constructors - TRIndicator improved calculation
- WMAIndicator improved calculation
- KSTIndicator improved calculation
- RSIIndicator simplify calculation
- FisherIndicator improved calculation
- DoubleEMAIndicator improved calculation
- CMOIndicator improved calculation
- PearsonCorrelationIndicator improved calculation
- PivotPoint-Indicators improved calculations
- ValueAtRiskCriterion improved calculation
- ExpectedShortfallCriterion improved calculation
- SqnCriterion improved calculation
- NumberOfBreakEvenPositionsCriterion shorten code
- AverageReturnPerBarCriterion improved calculation
- ZLEMAIndicator improved calculation
- InPipeRule improved calculation
- SumIndicator improved calculation
- updated pom.xml: slf4j-api to 2.0.7
- updated pom.xml: org.apache.poi to 5.2.3
- updated pom.xml: maven-jar-plugin to 3.3.0
- add
finalto properties where possible - improved javadoc
- SuperTrendIndicator,SuperTrendUpperIndicator,SuperTrendLowerIndicator: optimized calculation
- SuperTrendIndicator, SuperTrendLowerBandIndicator, SuperTrendUpperBandIndicator:
multiplierchanged to fromIntegertoDouble - add missing
@Overrideannotation - RecursiveCachedIndicator: simplified code
- LossIndicator: optimize calculation
- GainIndicator: improved calculation
- PriceVariationIndicator renamed to ClosePriceRatioIndicator for consistency with new ClosePriceDifferenceIndicator
- made UnaryOperation and BinaryOperation public
Removed/Deprecated
- removed Serializable from
CostModel - removed
@Deprecated Bar#addTrade(double tradeVolume, double tradePrice, Function<Number, Num> numFunction); useBar#addTrade(Num tradeVolume, Num tradePrice)instead. - removed
@Deprecated Bar#addTrade(String tradeVolume, String tradePrice, Function<Number, Num> numFunction); useBar#addTrade(Num tradeVolume, Num tradePrice)instead. - removed
DecimalNum.valueOf(DecimalNum) - delete
.travis.ymlas this project is managed by "Github actions"
Added
- added
TradingRecord.getStartIndex()andTradingRecord.getEndIndex()to track start and end of the recording - added SuperTrendIndicator
- added SuperTrendUpperBandIndicator
- added SuperTrendLowerBandIndicator
- added Donchian Channel indicators (Upper, Lower, and Middle)
- added
Indicator.getUnstableBars() - added
TransformIndicator.pow() - added
BarSeriesManager.getHoldingCostModel()andBarSeriesManager.getTransactionCostModel()to allow extending BarSeriesManager and reimplementingrun() - added
MovingAverageCrossOverRangeBacktest.javaandETH-USD-PT5M-2023-3-13_2023-3-15.jsontest data file to demonstrate parallel strategy evaluation - added javadoc improvements for percentage criteria
- added "lessIsBetter"-property for AverageCriterion
- added "lessIsBetter"-property for RelativeStandardDeviation
- added "lessIsBetter"-property for StandardDeviationCriterion
- added "lessIsBetter"-property for StandardErrorCriterion
- added "lessIsBetter"-property for VarianceCriterion
- added "lessIsBetter"-property for NumberOfPositionsCriterion
- added "addBase"-property for ReturnCriterion to include or exclude the base percentage of 1
- added RelativeVolumeStandardDeviationIndicator
- added MoneyFlowIndexIndicator
- added IntraDayMomentumIndexIndicator
- added ClosePriceDifferenceIndicator
- added TimeSegmentedVolumeIndicator
- added
DecimalNum.valueOf(DoubleNum)to convert a DoubleNum to a DecimalNum. - added
DoubleNum.valueOf(DecimalNum)to convert a DecimalNum to a DoubleNum. - added "TradeExecutionModel" to modify trade execution during backtesting
- added NumIndicator to calculate any
Num-value for aBar - added RunningTotalIndicator to calculate a cumulative sum for a period.
Fixed
- Fixed CashFlow fixed calculation with custom startIndex and endIndex
- Fixed Returns fixed calculation with custom startIndex and endIndex
- Fixed ExpectedShortfallCriterion fixed calculation with custom startIndex and endIndex
- Fixed MaximumDrawDownCriterion fixed calculation with custom startIndex and endIndex
- Fixed EnterAndHoldReturnCriterion fixed calculation with custom startIndex and endIndex
- Fixed VersusEnterAndHoldCriterion fixed calculation with custom startIndex and endIndex
- Fixed BarSeriesManager consider finishIndex when running backtest
Release 0.15
Release 0.15 of the Ta4j library.
This is the second release via GitHub Releases. Ta4j is also available on the maven central repository
Changelog for ta4j, roughly following keepachangelog.com from version 0.9 onwards.
0.15 (released September 11, 2022)
Breaking
- NumberOfConsecutiveWinningPositions renamed to
NumberOfConsecutivePositions - DifferencePercentage renamed to
DifferencePercentageIndicator - BuyAndHoldCriterion renamed to
EnterAndHoldCriterion - DXIndicator moved to adx-package
- PlusDMIndicator moved to adx-package
- MinusDMIndicator moved to adx-package
analysis/criterion-package moved to rootcost-package moved toanalysis/cost-package- AroonXXX indicators moved to aroon package
Fixed
- LosingPositionsRatioCriterion correct betterThan
- VersusBuyAndHoldCriterionTest NaN-Error.
- Fixed
ChaikinOscillatorIndicatorTest - DecimalNum#remainder() adds NaN-check
- Fixed ParabolicSarIndicatorTest fixed openPrice always 0 and highPrice lower than lowPrice
- UlcerIndexIndicator using the max price of current period instead of the highest value of last n bars
- DurationBarAggregator fixed aggregation of bars with gaps
Changed
- KeltnerChannelMiddleIndicator changed superclass to AbstractIndicator; add GetBarCount() and toString()
- KeltnerChannelUpperIndicator add constructor to accept pre-constructed ATR; add GetBarCount() and toString()
- KeltnerChannelLowerIndicator add constructor to accept pre-constructed ATR; add GetBarCount() and toString()
- BarSeriesManager removed empty args constructor
- Open|High|Low|Close do not cache price values anymore
- DifferenceIndicator(i1,i2) replaced by the more flexible CombineIndicator.minus(i1,i2)
- DoubleNum replace redundant
toString()call inDoubleNum.valueOf(Number i)withi.doubleValue() - ZeroCostModel now extends from
FixedTransactionCostModel
Removed/Deprecated
- Num removed Serializable
- PriceIndicator removed
Added
- NumericIndicator new class providing a fluent and lightweight api for indicator creation
- AroonFacade, BollingerBandFacade, KeltnerChannelFacade new classes providing a facade for indicator groups by using lightweight
NumericIndicators - AbstractEMAIndicator added getBarCount() to support future enhancements
- ATRIndicator "uncached" by changing superclass to AbstractIndicator; added constructor to accept TRIndicator and getter for same; added toString(); added getBarCount() to support future enhancements
- π Enhancement added possibility to use CostModels when backtesting with the BacktestExecutor
- π Enhancement added Num#zero, Num#one, Num#hundred
- π Enhancement added possibility to use CostModels when backtesting with the BacktestExecutor
- π Enhancement added Indicator#stream() method
- π Enhancement added a new CombineIndicator, which can combine the values of two Num Indicators with a given combine-function
- Example added a json serialization and deserialization example of BarSeries using google-gson library
- EnterAndHoldCriterion added constructor with TradeType to begin with buy or sell
- π Enhancement added Position#getStartingType() method
- π Enhancement added
SqnCriterion - π Enhancement added
StandardDeviationCriterion - π Enhancement added
RelativeStandardDeviationCriterion - π Enhancement added
StandardErrorCriterion - π Enhancement added
VarianceCriterion - π Enhancement added
AverageCriterion - π Enhancement added javadoc for all rules to make clear which rule makes use of a TradingRecord
- Enhancement prevent Object[] allocation for varargs log.trace and log.debug calls by wrapping them in
ifblocks - π Enhancement added
FixedTransactionCostModel - π Enhancement added
AnalysisCriterion.PositionFilterto handle both sides within one Criterion.
Release 0.14
Release 0.14 of the Ta4j library.
This is the first release via GitHub Releases. Ta4j is also available on the maven central repository
CHANGELOG:
0.14 (released April 25, 2021)
Breaking
- Breaking:
PrecisionNumrenamed toDecimalNum - Breaking:
AverageProfitableTradesCriterionrenamed toWinningTradesRatioCriterion - Breaking:
AverageProfitCriterionrenamed toAverageReturnPerBarCriterion - Breaking:
BuyAndHoldCriterionrenamed toBuyAndHoldReturnCriterion - Breaking:
RewardRiskRatioCriterionrenamed toReturnOverMaxDrawdownCriterion - Breaking:
ProfitLossCriterionmoved to PnL-Package - Breaking:
ProfitLossPercentageCriterionmoved to PnL-Package - Breaking:
TotalProfitCriterionrenamed toGrossReturnCriterionand moved to PnL-Package. - Breaking:
TotalProfit2Criterionrenamed toGrossProfitCriterionand moved to PnL-Package. - Breaking:
TotalLossCriterionrenamed toNetLossCriterionand moved to PnL-Package. - Breaking: package "tradereports" renamed to "reports"
- Breaking:
NumberOfTradesCriterionrenamed toNumberOfPositionsCriterion - Breaking:
NumberOfLosingTradesCriterionrenamed toNumberOfLosingPositionsCriterion - Breaking:
NumberOfWinningTradesCriterionrenamed toNumberOfWinningPositionsCriterion - Breaking:
NumberOfBreakEvenTradesCriterionrenamed toNumberOfBreakEvenPositionsCriterion - Breaking:
WinningTradesRatioCriterionrenamed toWinningPositionsRatioCriterion - Breaking:
TradeStatsReportrenamed toPositionStatsReport - Breaking:
TradeStatsReportGeneratorrenamed toPositionStatsReportGenerator - Breaking:
TradeOpenedMinimumBarCountRulerenamed toOpenedPositionMinimumBarCountRule - Breaking:
Trade.classrenamed toPosition.class - Breaking:
Order.classrenamed toTrade.class - Breaking: package "tradereports" renamed to "reports"
- Breaking: package "trading/rules" renamed to "rules"
- Breaking: remove Serializable from all indicators
- Breaking: Bar#trades: changed type from int to long
Fixed
- Fixed
Trade: problem with profit calculations on short trades. - Fixed
TotalLossCriterion: problem with profit calculations on short trades. - Fixed
BarSeriesBuilder: removed the Serializable interface - Fixed
ParabolicSarIndicator: problem with calculating in special cases - Fixed
BaseTimeSeries: can now be serialized - Fixed
ProfitLossPercentageCriterion: use entryPrice#getValue() instead of entryPrice#getPricePerAsset()
Changed
- Trade: Changed the way Nums are created.
- WinningTradesRatioCriterion (previously AverageProfitableTradesCriterion): Changed to calculate trade profits using Trade's getProfit().
- BuyAndHoldReturnCriterion (previously BuyAndHoldCriterion): Changed to calculate trade profits using Trade's getProfit().
- ExpectedShortfallCriterion: Removed unnecessary primitive boxing.
- NumberOfBreakEvenTradesCriterion: Changed to calculate trade profits using Trade's getProfit().
- NumberOfLosingTradesCriterion: Changed to calculate trade profits using Trade's getProfit().
- NumberOfWinningTradesCriterion: Changed to calculate trade profits using Trade's getProfit().
- ProfitLossPercentageCriterion: Changed to calculate trade profits using Trade's entry and exit prices.
- TotalLossCriterion: Changed to calculate trade profits using Trade's getProfit().
- TotalReturnCriterion (previously TotalProfitCriterion): Changed to calculate trade profits using Trade's getProfit().
- WMAIndicator: reduced complexity of WMAIndicator implementation
Removed/Deprecated
- MultiplierIndicator: replaced by TransformIndicator.
- AbsoluteIndicator: replaced by TransformIndicator.
Added
- Enhancement Improvements on gitignore
- Enhancement Added TradeOpenedMinimumBarCountRule - rule to specify minimum bar count for opened trade.
- Enhancement Added DateTimeIndicator a new Indicator for dates.
- Enhancement Added DayOfWeekRule for specifying days of the week to trade.
- Enhancement Added TimeRangeRule for trading within time ranges.
- Enhancement Added floor() and ceil() to Num.class
- Enhancement Added getters getLow() and getUp() in CrossedDownIndicatorRule
- Enhancement Added BarSeriesUtils: common helpers and shortcuts for BarSeries methods.
- Enhancement Improvements for PreviousValueIndicator: more descriptive toString() method, validation of n-th previous bars in
- Enhancement Added Percentage Volume Oscillator Indicator, PVOIndicator.
- Enhancement Added Distance From Moving Average Indicator, DistanceFromMAIndicator.
- Enhancement Added Know Sure Thing Indicator, KSTIndicator.
constructor of PreviousValueIndicator - π Enhancement added getGrossProfit() and getGrossProfit(BarSeries) on Trade.
- π Enhancement added getPricePerAsset(BarSeries) on Order.
- π Enhancement added convertBarSeries(BarSeries, conversionFunction) to BarSeriesUtils.
- π Enhancement added UnstableIndicator.
- π Enhancement added Chainrule.
- π Enhancement added BarSeriesUtils#sortBars.
- π Enhancement added BarSeriesUtils#addBars.
- π Enhancement added Num.negate() to negate a Num value.
- π Enhancement added
GrossLossCriterion.class. - π Enhancement added
NetProfitCriterion.class. - π Enhancement added chooseBest() method with parameter tradeType in AnalysisCriterion.
- π Enhancement added
AverageLossCriterion.class. - π Enhancement added
AverageProfitCriterion.class. - π Enhancement added
ProfitLossRatioCriterion.class. - π Enhancement added
ExpectancyCriterion.class. - π Enhancement added
ConsecutiveWinningPositionsCriterion.class. - π Enhancement added
LosingPositionsRatioCriterion.class - π Enhancement added Position#hasProfit.
- π Enhancement added Position#hasLoss.
- π Enhancement exposed both EMAs in MACD indicator