Class SwingPoint
java.lang.Object
com.motivewave.platform.sdk.common.SwingPoint
- All Implemented Interfaces:
Comparable<SwingPoint>
Identifies a swing point (local high or low) on a chart.
-
Constructor Summary
ConstructorDescriptionSwingPoint
(boolean top, int index, long time, double value, int strLeft, int strRight) Constructor -
Method Summary
Modifier and TypeMethodDescriptionint
compareTo
(SwingPoint sp) Compares this swing point to another point This is used to sort swing points by time.double
Gets the average strength of this swing point ((left strength +right strength)/2)Gets the coordinate for the swing point (time, value).int
getIndex()
Index of the bar in the data series.int
Gets the strength of this swing point (minimum of left and right strength).int
Gets the number of bars to the left of this point.int
Gets the number of bars to the right of this point.long
getTime()
Gets the start time of the bar in the data series (milliseconds since 1970).double
getValue()
Gets the value of the bar (high for top, low for bottom) in the data series.boolean
isBottom()
Determines if this is a bottom swing point (local low).boolean
isTop()
Determines if this is a top swing point (local high).toString()
-
Constructor Details
-
SwingPoint
public SwingPoint(boolean top, int index, long time, double value, int strLeft, int strRight) Constructor- Parameters:
top
- true if this is a top swing point (local high)index
- index in the data seriestime
- time of the swing point bar (milliseconds since 1970)value
- value of the swing point barstrLeft
- left strength (number of bars to the left of this point)strRight
- right strength (number of bars to the right of this point)
-
-
Method Details
-
isTop
public boolean isTop()Determines if this is a top swing point (local high).- Returns:
- true if this is a top swing point
-
isBottom
public boolean isBottom()Determines if this is a bottom swing point (local low).- Returns:
- true if this is a bottom swing point
-
getStrengthLeft
public int getStrengthLeft()Gets the number of bars to the left of this point.- Returns:
- number of bars to the left of this point
-
getStrengthRight
public int getStrengthRight()Gets the number of bars to the right of this point.- Returns:
- number of bars to the right of this point
-
getIndex
public int getIndex()Index of the bar in the data series.- Returns:
- index of the bar in the data series
-
getTime
public long getTime()Gets the start time of the bar in the data series (milliseconds since 1970).- Returns:
- start time of the bar in the data series
-
getValue
public double getValue()Gets the value of the bar (high for top, low for bottom) in the data series.- Returns:
- value of the swing point bar
-
getCoordinate
Gets the coordinate for the swing point (time, value).- Returns:
- coordinate for the swing point
-
getStrength
public int getStrength()Gets the strength of this swing point (minimum of left and right strength).- Returns:
- strength of this swing point
-
getAvgStrength
public double getAvgStrength()Gets the average strength of this swing point ((left strength +right strength)/2)- Returns:
- average strength of this swing point
-
compareTo
Compares this swing point to another point This is used to sort swing points by time.- Specified by:
compareTo
in interfaceComparable<SwingPoint>
-
toString
-