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
TradeOnNextOpenModel
by default, which opens new trades at indext + 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)
- 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
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 fromInteger
toDouble
- 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)
; 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.yml
as 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.java
andETH-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 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