Class FramaRTIndicator
java.lang.Object
com.wualabs.qtsurfer.engine.indicators.core.AbstractRTIndicator
com.wualabs.qtsurfer.engine.indicators.averages.pro.FramaRTIndicator
- All Implemented Interfaces:
Resettable, RTIndicator
Fractal Adaptive Moving Average (FRAMA) by John Ehlers.
Adapts the EMA smoothing factor based on the fractal dimension of price:
N1 = (max(first half) - min(first half)) / (N/2) N2 = (max(second half) - min(second half)) / (N/2) N3 = (max(full) - min(full)) / N D = (ln(N1 + N2) - ln(N3)) / ln(2) alpha = exp(-4.6 * (D - 1)) clamped to [0.01, 1.0] FRAMA = alpha * price + (1 - alpha) * prevFRAMA
When prices are trending (D near 1), alpha is high and FRAMA reacts quickly. When prices are noisy (D near 2), alpha is very small and FRAMA is smooth.
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class AbstractRTIndicator
equals, getDisplayHint, getMeta, getValue, hashCode, hide, isPoison, setValue, toString, toString, withDisplayHint, withMeta
-
Constructor Details
-
FramaRTIndicator
public FramaRTIndicator() -
FramaRTIndicator
public FramaRTIndicator(int periods)
-
-
Method Details
-
getPeriods
public int getPeriods() -
getFractalDimension
public double getFractalDimension() -
getAlpha
public double getAlpha() -
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
-