public class Ema extends AbstractMa implements Serializable
An EMA.
AbstractMa.Mode, AbstractMa.Type
lastSample, lastTimestamp, mode, timeScale, type
Constructor and Description |
---|
Ema(AbstractMa.Type type,
AbstractMa.Mode mode,
double timeScale)
Constructs a new EMA which use the given timescale.
|
Modifier and Type | Method and 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.
|
getLastSample, getLastTimestamp, getTimeScale, processDouble, setTimeScale
public Ema(AbstractMa.Type type, AbstractMa.Mode mode, double timeScale)
type
- type of EMAmode
- compute the ema by tick or timetimeScale
- timescale for the EMAs.protected void processDoubleLocal(long timestamp, double data)
processDoubleLocal
in class AbstractMa
public double getCurrent()
getCurrent
in class AbstractMa
public void setCurrent(double value)
setCurrent
in class AbstractMa
value
- new value of the ema state.public void reset()
reset
in class AbstractMa