Skip to content

Releases: ta4j/ta4j

Release 0.16

17 May 14:27
Compare
Choose a tag to compare

Release 0.16 of the Ta4j library.

This is the third release via GitHub Releases. Ta4j is also available on the maven central repository

www.ta4j.org

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 TradeOnNextOpenModel by default, which opens new trades at index t + 1 at the open price.
    • For strategies require the previous behaviour, i.e. trades seconds or minutes before the closing prices, TradeOnCurerentCloseModel can be passed to BarSeriesManager
      • For example:
        • BarSeriesManager manager = new BarSeriesManager(barSeries, new TradeOnCurrentCloseModel())
        • BarSeriesManager manager = new BarSeriesManager(barSeries, transactionCostModel, holdingCostModel, tradeExecutionModel)
  • 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) is NaN
  • 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 currentStopLossLimitActivation because 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 NaN if 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 UnsupportedOperationException when 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 DecimalNum type 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 final to properties where possible
  • improved javadoc
  • SuperTrendIndicator,SuperTrendUpperIndicator,SuperTrendLowerIndicator: optimized calculation
  • SuperTrendIndicator, SuperTrendLowerBandIndicator, SuperTrendUpperBandIndicator: multiplier changed to from Integer to Double
  • add missing @Override annotation
  • 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); use Bar#addTrade(Num tradeVolume, Num tradePrice) instead.
  • removed @Deprecated Bar#addTrade(String tradeVolume, String tradePrice, Function<Number, Num> numFunction); use Bar#addTrade(Num tradeVolume, Num tradePrice) instead.
  • removed DecimalNum.valueOf(DecimalNum)
  • delete .travis.yml as this project is managed by "Github actions"

Added

  • added TradingRecord.getStartIndex() and TradingRecord.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() and BarSeriesManager.getTransactionCostModel() to allow extending BarSeriesManager and reimplementing run()
  • added MovingAverageCrossOverRangeBacktest.java and ETH-USD-PT5M-2023-3-13_2023-3-15.json test 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 a Bar
  • 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

11 Sep 14:54
Compare
Choose a tag to compare

Release 0.15 of the Ta4j library.

This is the second release via GitHub Releases. Ta4j is also available on the maven central repository

www.ta4j.org

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 root
  • cost-package moved to analysis/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 in DoubleNum.valueOf(Number i) with i.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 if blocks
  • πŸŽ‰ Enhancement added FixedTransactionCostModel
  • πŸŽ‰ Enhancement added AnalysisCriterion.PositionFilter to handle both sides within one Criterion.

Release 0.14

25 Apr 13:28
Compare
Choose a tag to compare

Release 0.14 of the Ta4j library.

This is the first release via GitHub Releases. Ta4j is also available on the maven central repository

www.ta4j.org

CHANGELOG:

0.14 (released April 25, 2021)

Breaking

  • Breaking: PrecisionNum renamed to DecimalNum
  • Breaking: AverageProfitableTradesCriterion renamed to WinningTradesRatioCriterion
  • Breaking: AverageProfitCriterion renamed to AverageReturnPerBarCriterion
  • Breaking: BuyAndHoldCriterion renamed to BuyAndHoldReturnCriterion
  • Breaking: RewardRiskRatioCriterion renamed to ReturnOverMaxDrawdownCriterion
  • Breaking: ProfitLossCriterion moved to PnL-Package
  • Breaking: ProfitLossPercentageCriterion moved to PnL-Package
  • Breaking: TotalProfitCriterion renamed to GrossReturnCriterion and moved to PnL-Package.
  • Breaking: TotalProfit2Criterion renamed to GrossProfitCriterion and moved to PnL-Package.
  • Breaking: TotalLossCriterion renamed to NetLossCriterion and moved to PnL-Package.
  • Breaking: package "tradereports" renamed to "reports"
  • Breaking: NumberOfTradesCriterion renamed to NumberOfPositionsCriterion
  • Breaking: NumberOfLosingTradesCriterion renamed to NumberOfLosingPositionsCriterion
  • Breaking: NumberOfWinningTradesCriterion renamed to NumberOfWinningPositionsCriterion
  • Breaking: NumberOfBreakEvenTradesCriterion renamed to NumberOfBreakEvenPositionsCriterion
  • Breaking: WinningTradesRatioCriterion renamed to WinningPositionsRatioCriterion
  • Breaking: TradeStatsReport renamed to PositionStatsReport
  • Breaking: TradeStatsReportGenerator renamed to PositionStatsReportGenerator
  • Breaking: TradeOpenedMinimumBarCountRule renamed to OpenedPositionMinimumBarCountRule
  • Breaking: Trade.class renamed to Position.class
  • Breaking: Order.class renamed to Trade.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