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.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.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, reset, setValue, toString, toString, withDisplayHint, withMeta
-
Constructor Details
-
VolatilityRTIndicator
public VolatilityRTIndicator() -
VolatilityRTIndicator
-
-
Method Details
-
clampUpdates
-
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
-