Class IchimokuRTIndicator
- All Implemented Interfaces:
Resettable, CacheableRTIndicator, RichRTIndicator<MarketSnapshot>, RTIndicator
Produces five lines:
- Tenkan-sen (Conversion Line): (highest-high + lowest-low) / 2 over tenkanPeriod (default 9)
- Kijun-sen (Base Line): (highest-high + lowest-low) / 2 over kijunPeriod (default 26)
- Senkou Span A (Leading Span A): (Tenkan-sen + Kijun-sen) / 2, plotted kijunPeriod ahead
- Senkou Span B (Leading Span B): (highest-high + lowest-low) / 2 over senkouPeriod (default 52), plotted kijunPeriod ahead
- Chikou Span (Lagging Span): current close, plotted kijunPeriod behind
The main AbstractRTIndicator.getValue() returns the Tenkan-sen. All five lines are accessible
via dedicated getters.
Uses ring buffers with tracked min/max for O(n) worst-case per eviction but O(1) amortized. For the typical case where prices trend, the deque-based min/max is not needed — a full scan on eviction is simpler and sufficient for periods 9/26/52.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates an Ichimoku indicator with default periods (9, 26, 52).IchimokuRTIndicator(int tenkanPeriod, int kijunPeriod, int senkouPeriod) Creates an Ichimoku indicator with custom periods. -
Method Summary
Modifier and TypeMethodDescriptiondoubleChikou Span (Lagging Span) — current close value.intdoubleKijun-sen (Base Line).intdoubleSenkou Span A (Leading Span A).doubleSenkou Span B (Leading Span B).intdoubleTenkan-sen (Conversion Line) — also the main getValue().booleanisReady()Returns whether this indicator has received enough data to produce meaningful values.booleanReturns true when Tenkan-sen and Kijun-sen are available (before full Senkou readiness).booleanWhether this indicator's result is only meaningful over per-bar OHLCV data.voidreset()This instance's math identity — equal signatures must mean identical value series for identical input.doubleupdate(double newValue) Standalone mode — treats input as close price, uses it for both high and low.doubleupdateFrom(MarketSnapshot snap) Updates the indicator from a full market snapshot.doubleupdateOhlc(double high, double low, double close) Updates Ichimoku from OHLC primitive values.Methods inherited from class AbstractRTIndicator
equals, getDisplayHint, getMeta, getValue, hashCode, hide, isPoison, setValue, toString, toString, withDisplayHint, withMetaMethods inherited from interface RTIndicator
getDisplayHint, getId, getMeta, getValue, isHidden, ro, update, update
-
Constructor Details
-
IchimokuRTIndicator
public IchimokuRTIndicator()Creates an Ichimoku indicator with default periods (9, 26, 52). -
IchimokuRTIndicator
public IchimokuRTIndicator(int tenkanPeriod, int kijunPeriod, int senkouPeriod) Creates an Ichimoku indicator with custom periods.- Parameters:
tenkanPeriod- Conversion Line period (default 9)kijunPeriod- Base Line period (default 26)senkouPeriod- Leading Span B period (default 52)
-
-
Method Details
-
getTenkanPeriod
public int getTenkanPeriod() -
getKijunPeriod
public int getKijunPeriod() -
getSenkouPeriod
public int getSenkouPeriod() -
signature
Description copied from interface:CacheableRTIndicatorThis instance's math identity — equal signatures must mean identical value series for identical input.- Specified by:
signaturein interfaceCacheableRTIndicator- Returns:
- the identity, or
nullwhen this instance cannot state one (an unidentifiable source, a mode the implementation does not model) and must therefore compute live
-
isReady
public boolean isReady()Description copied from interface:RTIndicatorReturns whether this indicator has received enough data to produce meaningful values.During the warmup period,
RTIndicator.getValue()may return 0 or a partial estimate that should not be used for trading decisions. Once this method returnstrue, the indicator's output is statistically valid.The default implementation returns
truefor backward compatibility. Indicators with warmup requirements should override this method.For composite indicators (e.g. Bollinger Bands, MACD), readiness is determined by the slowest internal component.
- Specified by:
isReadyin interfaceRTIndicator- Returns:
trueif the indicator has completed its warmup period
-
isTenkanKijunReady
public boolean isTenkanKijunReady()Returns true when Tenkan-sen and Kijun-sen are available (before full Senkou readiness). -
getTenkanSen
public double getTenkanSen()Tenkan-sen (Conversion Line) — also the main getValue(). -
getKijunSen
public double getKijunSen()Kijun-sen (Base Line). -
getSenkouSpanA
public double getSenkouSpanA()Senkou Span A (Leading Span A). -
getSenkouSpanB
public double getSenkouSpanB()Senkou Span B (Leading Span B). -
getChikouSpan
public double getChikouSpan()Chikou Span (Lagging Span) — current close value. -
reset
public void reset()- Specified by:
resetin interfaceResettable- Overrides:
resetin classAbstractRTIndicator
-
requiresBarData
public boolean requiresBarData()Whether this indicator's result is only meaningful over per-bar OHLCV data.The distinction matters because a
RichRTIndicator<MarketSnapshot>accepts aTickerSnapshotjust as happily as aKlineSnapshot— and on the ticker pathvolume,high,lowandopenare the exchange's 24-hour rolling statistics, not this tick's bar. Nothing throws: OBV silently accumulates a 24h volume figure over and over, ATR reads a 24h range as if it were one bar's. The numbers look plausible and mean nothing, which is the worst failure mode of the three.Indicators that return
trueare flagged once per (indicator, instrument) when bound on the ticker path — seeInstrumentMapTickerSourceRTIndicator. Scalar indicators (SMA/EMA/RSI over a single price) are unaffected and default tofalse.true: this indicator reads per-bar OHLCV, which the ticker path does not carry.- Specified by:
requiresBarDatain interfaceRichRTIndicator<MarketSnapshot>- Returns:
trueif this indicator needs real bar data;falseby default
-
updateFrom
Description copied from interface:RichRTIndicatorUpdates the indicator from a full market snapshot. Returns the new value so callers can chain (matchingRTIndicator.update(double)'s contract).- Specified by:
updateFromin interfaceRichRTIndicator<MarketSnapshot>
-
updateOhlc
public double updateOhlc(double high, double low, double close) Updates Ichimoku from OHLC primitive values.- Returns:
- the Tenkan-sen value
-
update
public double update(double newValue) Standalone mode — treats input as close price, uses it for both high and low. For proper Ichimoku, useupdateOhlc(double, double, double)orupdateFrom(MarketSnapshot).- Specified by:
updatein interfaceRTIndicator- Overrides:
updatein classAbstractRTIndicator
-