Class Ema
java.lang.Object
com.illumon.numerics.movingaverages.AbstractMa
com.illumon.numerics.movingaverages.Ema
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
TradingHoursEma
public class Ema extends AbstractMa implements Serializable
An EMA.
- See Also:
- Serialized Form
-
Nested Class Summary
Nested classes/interfaces inherited from class com.illumon.numerics.movingaverages.AbstractMa
AbstractMa.Mode, AbstractMa.Type
-
Field Summary
Fields inherited from class com.illumon.numerics.movingaverages.AbstractMa
lastSample, lastTimestamp, mode, timeScale, type
-
Constructor Summary
Constructors Constructor Description Ema(AbstractMa.Type type, AbstractMa.Mode mode, double timeScale)
Constructs a new EMA which use the given timescale. -
Method Summary
Modifier and Type Method Description double
getCurrent()
Gets the current value of the ema.protected void
processDoubleLocal(long timestamp, double data)
void
reset()
void
setCurrent(double value)
Sets the current value of the ema state.Methods inherited from class com.illumon.numerics.movingaverages.AbstractMa
getLastSample, getLastTimestamp, getTimeScale, processDouble, setTimeScale
-
Constructor Details
-
Ema
Constructs a new EMA which use the given timescale.- Parameters:
type
- type of EMAmode
- compute the ema by tick or timetimeScale
- timescale for the EMAs.
-
-
Method Details
-
processDoubleLocal
protected void processDoubleLocal(long timestamp, double data)- Specified by:
processDoubleLocal
in classAbstractMa
-
getCurrent
public double getCurrent()Gets the current value of the ema.- Specified by:
getCurrent
in classAbstractMa
- Returns:
- current value of the ema.
-
setCurrent
public void setCurrent(double value)Sets the current value of the ema state.- Specified by:
setCurrent
in classAbstractMa
- Parameters:
value
- new value of the ema state.
-
reset
public void reset()- Specified by:
reset
in classAbstractMa
-