Detect accumulation, distribution, and trend phases using the Wyckoff method indicators.
The Wyckoff method analyses price and volume to identify the four canonical market phases:
Accumulation — smart money builds positions quietly in a trading range before markup.
Markup — price trends upward after a successful accumulation.
Distribution — smart money unwinds positions in a new trading range before markdown.
Markdown — price trends downward after distribution.
Within each accumulation or distribution range, Wyckoff further subdivides the activity into phases A through E, capturing the stopping action (A), cause-building (B), test (C), trend confirmation (D), and trend in motion (E).ta4j exposes Wyckoff analysis through two entry points:
WyckoffCycleFacade — indicator-style, per-bar access. Use this in strategy rules and chart overlays.
WyckoffCycleAnalysisRunner — one-shot snapshot across one or more configuration degrees.
WyckoffCycleFacade wires the WyckoffPhaseIndicator and its supporting components from a single fluent builder. The facade gives you phase values, trading-range boundaries, and phase transition tracking at any bar index.
Bars preceding a pivot, bars following, allowed equal bars
.withVolumeWindows(int, int)
5, 20
Short and long volume SMA window lengths
.withTolerances(Num, Num)
0.02, 0.05
Breakout tolerance and retest tolerance as ratios
.withVolumeThresholds(Num, Num)
1.6, 0.7
Climax threshold ratio and dry-up threshold ratio
All swing bars and volume windows must meet the constraints: precedingSwingBars >= 1, followingSwingBars >= 0, shortWindow >= 1, and longWindow >= shortWindow. Violating any constraint throws IllegalArgumentException.
WyckoffCycleAnalysisRunner runs a one-shot Wyckoff analysis and collects all phase transitions across the full series. It can optionally run at higher or lower configuration degree offsets — coarser swing detection at positive offsets, finer at negative offsets.
1
Build the runner
var runner = WyckoffCycleAnalysisRunner.builder() .withSwingConfiguration(3, 3, 1) .withVolumeWindows(5, 20) .withTolerances(0.02, 0.05) .withVolumeThresholds(1.5, 0.7) .higherDegrees(1) // also analyze with coarser parameters (+1 offset) .lowerDegrees(0) .build();
2
Run analysis
WyckoffCycleAnalysisResult result = runner.analyze(series);
Unlike Elliott Wave, Wyckoff analysis in ta4j does not use a canonical degree enum. Instead, WyckoffCycleAnalysisRunner expresses “degrees” as integer offsets from the base configuration (offset 0). Positive offsets coarsen the swing detection and lengthen volume windows; negative offsets tighten them.The default DegreeConfigurationProvider scales precedingSwingBars, followingSwingBars, volumeShortWindow, and volumeLongWindow linearly by the degree offset. Provide a custom DegreeConfigurationProvider for full control.
The demo loads a CSV-backed BarSeries, builds a facade with custom tolerances, iterates the series printing phase transitions, then runs WyckoffCycleAnalysisRunner for a one-shot snapshot.
WyckoffPhaseIndicator requires a warm-up period. Always start iteration at series.getBeginIndex() + facade.unstableBars() to avoid reading undefined values during the warm-up window.