Class NeighborEmaArrayDifferencer
java.lang.Object
com.illumon.numerics.movingaverages.NeighborEmaArrayDifferencer
- All Implemented Interfaces:
Serializable
Computes the differences between values in an array of emas.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionNeighborEmaArrayDifferencer(AbstractMa.Mode emaMode, double[] emaTimescales, boolean includeDifferenceWithCurrentValue) Constructs a new calculator. -
Method Summary
Modifier and TypeMethodDescriptiondouble[]Gets the current difference in the latest value and the emas.doublelongGets the last time the ema was updated.voidprocessDouble(long timestamp, double data) voidreset()
-
Constructor Details
-
NeighborEmaArrayDifferencer
public NeighborEmaArrayDifferencer(AbstractMa.Mode emaMode, double[] emaTimescales, boolean includeDifferenceWithCurrentValue) Constructs a new calculator.- Parameters:
emaMode- type of ema calculation.emaTimescales- timescales for the ema.includeDifferenceWithCurrentValue- true includes the difference between the latest input value and the first ema in the output results; false does not.
-
-
Method Details
-
processDouble
public void processDouble(long timestamp, double data) -
getCurrent
public double[] getCurrent()Gets the current difference in the latest value and the emas.- Returns:
- current difference in the latest value and the emas.
-
reset
public void reset() -
getLastTimestamp
public long getLastTimestamp()Gets the last time the ema was updated.- Returns:
- last time the ema was updated.
-
getLastSample
public double getLastSample()
-