Class AlmaRTIndicator
- All Implemented Interfaces:
Resettable, RTIndicator
Gaussian-weighted moving average that balances smoothness and responsiveness. i
indexes the window oldest (0) to newest (periods-1), matching offset:
w[i] = exp(-((i - offset)^2) / (2 * sigma^2)) ALMA = sum(w[i] * price[i]) / sum(w[i])
Default parameters: offset factor = 0.85, sigma factor = 6 — with the default offset,
offset sits near periods-1 (the newest sample), which is what gives ALMA its
low lag versus a plain centered Gaussian-weighted average.
-
Constructor Summary
ConstructorsConstructorDescriptionAlmaRTIndicator(int periods) AlmaRTIndicator(int periods, double offsetFactor, double sigmaFactor) -
Method Summary
Methods inherited from class AbstractRTIndicator
equals, getDisplayHint, getMeta, getValue, hashCode, hide, isPoison, setValue, toString, toString, withDisplayHint, withMeta
-
Constructor Details
-
AlmaRTIndicator
public AlmaRTIndicator(int periods) -
AlmaRTIndicator
public AlmaRTIndicator(int periods, double offsetFactor, double sigmaFactor)
-
-
Method Details
-
getPeriods
public int getPeriods() -
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.
- Returns:
trueif the indicator has completed its warmup period
-
reset
public void reset()- Specified by:
resetin interfaceResettable- Overrides:
resetin classAbstractRTIndicator
-
update
public double update(double newValue) - Specified by:
updatein interfaceRTIndicator- Overrides:
updatein classAbstractRTIndicator
-