Class VolatilityRTIndicator
java.lang.Object
com.wualabs.qtsurfer.engine.indicators.core.AbstractRTIndicator
com.wualabs.qtsurfer.engine.indicators.helpers.VolatilityRTIndicator
- All Implemented Interfaces:
Resettable, RTIndicator
- Direct Known Subclasses:
PercentVolatilityRTIndicator
Measures price volatility by tracking whether consecutive values change.
By default, feeds 1 (changed) or 0 (unchanged) into an averaging indicator
and returns the result as a percentage. Supports an initial clamp period
where
getValue() returns 0 to suppress noisy startup values.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclampUpdates(int clampUpdateCount) doublegetValue()Returns the current volatility value, or 0 if still in the clamp period.booleanisReady()Ready when the averaging indicator it feeds is, and once the clamp period (a warm-up the owner asked for, through whichgetValue()reads 0) is over.protected doublenextValue(RTIndicator averageIndicator, double prevValue, double newValue) Computes the volatility signal: feeds 1 (changed) or 0 (unchanged) into the averaging indicator and scales the result to a percentage.voidreset()Returns it to its pre-first-update state: the previous value is forgotten, the averaging indicator it feeds goes back to its start, and a configured clamp period starts over.doubleupdate(double newValue) Processes a new value by computing the volatility metric from the price change between consecutive updates.Methods inherited from class AbstractRTIndicator
equals, getDisplayHint, getMeta, hashCode, hide, isPoison, setValue, toString, toString, withDisplayHint, withMeta
-
Constructor Details
-
VolatilityRTIndicator
public VolatilityRTIndicator() -
VolatilityRTIndicator
-
-
Method Details
-
clampUpdates
-
isReady
public boolean isReady()Ready when the averaging indicator it feeds is, and once the clamp period (a warm-up the owner asked for, through whichgetValue()reads 0) is over.- Returns:
trueif the indicator has completed its warmup period
-
reset
public void reset()Returns it to its pre-first-update state: the previous value is forgotten, the averaging indicator it feeds goes back to its start, and a configured clamp period starts over.- Specified by:
resetin interfaceResettable- Overrides:
resetin classAbstractRTIndicator
-
update
public double update(double newValue) Processes a new value by computing the volatility metric from the price change between consecutive updates. On the first call, only stores the initial value. During the clamp period, the stored value updates internally butgetValue()returns 0 to suppress startup noise.- Specified by:
updatein interfaceRTIndicator- Overrides:
updatein classAbstractRTIndicator- Parameters:
newValue- the new input price- Returns:
- the volatility value (or 0 during the clamp period)
-
getValue
public double getValue()Returns the current volatility value, or 0 if still in the clamp period.- Specified by:
getValuein interfaceRTIndicator- Overrides:
getValuein classAbstractRTIndicator
-
nextValue
Computes the volatility signal: feeds 1 (changed) or 0 (unchanged) into the averaging indicator and scales the result to a percentage.- Parameters:
averageIndicator- the averaging indicator for smoothingprevValue- the previous input valuenewValue- the current input value- Returns:
- the averaged change rate as a percentage
-