Class ChandeKrollStopRTIndicator
- All Implemented Interfaces:
Resettable, CacheableRTIndicator, RichRTIndicator<MarketSnapshot>, RTIndicator
trueRange = max(high - low, |high - prevClose|, |low - prevClose|) firstHighStop = highest(close, stopPeriod) - ATR(atrPeriod) * multiplier firstLowStop = lowest(close, stopPeriod) + ATR(atrPeriod) * multiplier stopShort = highest(firstHighStop, finalPeriod) stopLong = lowest(firstLowStop, finalPeriod)
A volatility-based stop-loss indicator. stopLong is the trailing stop for
long positions; stopShort is the trailing stop for short positions.
The main AbstractRTIndicator.getValue() returns stopLong by default.
-
Constructor Summary
ConstructorsConstructorDescriptionChandeKrollStopRTIndicator(int atrPeriod, double multiplier, int stopPeriod, int finalPeriod) -
Method Summary
Modifier and TypeMethodDescriptionintintdoubledoubleintdoublebooleanisReady()Returns whether this indicator has received enough data to produce meaningful values.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) doubleupdateFrom(MarketSnapshot snap) Updates the indicator from a full market snapshot.doubleupdateOhlc(double high, double low, double close) 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
-
ChandeKrollStopRTIndicator
public ChandeKrollStopRTIndicator() -
ChandeKrollStopRTIndicator
public ChandeKrollStopRTIndicator(int atrPeriod, double multiplier, int stopPeriod, int finalPeriod)
-
-
Method Details
-
getAtrPeriod
public int getAtrPeriod() -
getMultiplier
public double getMultiplier() -
getStopPeriod
public int getStopPeriod() -
getFinalPeriod
public int getFinalPeriod() -
getStopLong
public double getStopLong() -
getStopShort
public double getStopShort() -
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
-
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) -
update
public double update(double newValue) - Specified by:
updatein interfaceRTIndicator- Overrides:
updatein classAbstractRTIndicator
-