org.encog.app.quant.util
Class BarBuffer
- java.lang.Object
-
- org.encog.app.quant.util.BarBuffer
-
public class BarBuffer extends java.lang.ObjectA buffer of bar segments.
-
-
Constructor Summary
Constructors Constructor and Description BarBuffer(int thePeriods)Construct the object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidadd(double d)Add a bar.voidadd(double[] d)Add a bar.doubleaverage(int idx)Average all of the bars.doubleaverageGain(int idx)Get the average gain.doubleaverageLoss(int idx)Get the average loss.java.util.List<double[]>getData()booleangetFull()Determine if the buffer is full.doublemax(int idx)Get the max for the specified index.doublemin(int idx)Get the min for the specified index.double[]pop()Pop (and remove) the oldest bar in the buffer.
-
-
-
Constructor Detail
-
BarBuffer
public BarBuffer(int thePeriods)
Construct the object.- Parameters:
thePeriods- The number of periods.
-
-
Method Detail
-
add
public final void add(double d)
Add a bar.- Parameters:
d- The bar data.
-
add
public final void add(double[] d)
Add a bar.- Parameters:
d- The bar data.
-
average
public final double average(int idx)
Average all of the bars.- Parameters:
idx- The bar index to average.- Returns:
- The average.
-
averageGain
public final double averageGain(int idx)
Get the average gain.- Parameters:
idx- The field to get the average gain for.- Returns:
- The average gain.
-
averageLoss
public final double averageLoss(int idx)
Get the average loss.- Parameters:
idx- The index to check for.- Returns:
- The average loss.
-
getData
public final java.util.List<double[]> getData()
- Returns:
- The data.
-
getFull
public final boolean getFull()
Determine if the buffer is full.- Returns:
- True if the buffer is full.
-
max
public final double max(int idx)
Get the max for the specified index.- Parameters:
idx- The index to check.- Returns:
- The max.
-
min
public final double min(int idx)
Get the min for the specified index.- Parameters:
idx- The index to check.- Returns:
- The min.
-
pop
public final double[] pop()
Pop (and remove) the oldest bar in the buffer.- Returns:
- The oldest bar in the buffer.
-
-
DMelt 3.0 © DataMelt by jWork.ORG