Ta4j Wiki

Documentation, examples and further information of the ta4j project

View the Wiki On GitHub

This project is maintained by ta4j Organization

Stop Rules Refactor Checklist

Last updated: 2026-02-05 Scope: stop-loss and stop-gain rule additions in feature/risk-controls (bdd4407e)

Goals

Guiding Principles

Current Focus Area

Prioritized Refactor Opportunities

  1. P1 Clarify and align threshold trigger semantics for volatility rules.
    • BaseVolatilityStopLossRule uses strict comparisons (< / >) while gain-side uses inclusive comparisons (>= / <=).
    • Decide expected threshold semantics and encode with tests before changing behavior.
  2. P2 Replace gain-side calls to StopLossRule.stopLossPrice* with gain-focused helpers.
    • Affects trailing gain implementations that currently call stop-loss helper methods despite gain semantics.
    • Improves readability and lowers maintenance risk.
  3. P2 Normalize constructor validation and API parity across stop-loss/stop-gain pairs.
    • Ensure null/invalid argument handling is explicit and consistent.
    • Align ATR trailing constructors for bar-count configurability or document intentional asymmetry.
  4. P3 Reduce test duplication in stop rule test suites.
    • Consolidate repeated bar-series setup and buy/sell scenario scaffolding.

Test Coverage Gaps

Checklist