Class BarSize

java.lang.Object
com.motivewave.platform.sdk.common.BarSize
All Implemented Interfaces:
Comparable<BarSize>

public class BarSize extends Object implements Comparable<BarSize>
Describes the bar size for the historical data.
  • Method Details

    • getIntervalMinutes

      public int getIntervalMinutes()
      Gets the interval for this bar. For linear bars, this is the number of minutes in this bar.
      Returns:
      the bar interval.
    • getIntervalSeconds

      public int getIntervalSeconds()
      Gets the interval for this bar. For linear bars, this is the number of seconds in this bar.
      Returns:
      the bar interval in seconds.
    • getIntervalMillis

      public long getIntervalMillis()
      Gets the interval for this bar. For linear bars, this is the number of seconds in this bar.
      Returns:
      the bar interval in seconds.
    • getInterval

      public int getInterval()
      Gets the interval for this bar. For the meaning of this value see interval type.
      Returns:
      the bar interval.
    • getReverseInterval

      public int getReverseInterval()
      Gets the reverse bar interval. Currently this only applies to Hybrid Renko and Point & Figure bars.
      Returns:
      the bar reverse interval (Hybrid Renko, Point & Figure bars only).
    • getSizeMillis

      public long getSizeMillis()
      Gets the size of the bar in milliseconds. This is only applicable to linear bars. Non-linear bars will return -1
      Returns:
      size in milliseconds
    • isLinear

      public boolean isLinear()
      Determines if this bar is a fixed time interval (in minutes).
      Returns:
      true if this is a linear bar size (ie minutes > 0)
    • isFixedSize

      public boolean isFixedSize()
      Determines if the bar has a fixed size in terms of time.
      Returns:
      true if this bar has a fixed size in terms of time
    • isIntraday

      public boolean isIntraday()
      Indicates if this bar size is intra-day (less than 1 day).
      Returns:
      true if this bar is intra-day (less than 1 day)
    • getIntervalType

      public Enums.IntervalType getIntervalType()
      Indicates the measurement type of the interval parameter (ie minutes, days, seconds, pips)
      Returns:
      type of interval measurement
    • getType

      public Enums.BarSizeType getType()
      Gets the type of bar size.
      Returns:
      type of the bar size
    • isRenko

      public boolean isRenko()
      Determines if this is a Renko (Japanese Brick) bar size.
      Returns:
      true if this is a Renko (Japanese Brick) bar.
    • isPointAndFigure

      public boolean isPointAndFigure()
      Determines if this is a Point & Figure bar size.
      Returns:
      true if this is a Point & Figure bar.
    • isReversal

      public boolean isReversal()
      Determines if this is a Reversal bar size.
      Returns:
      true if this is a Reversal bar.
    • isRange

      public boolean isRange()
      Determines if this is a constant range bar size.
      Returns:
      true if this is a Range interval bar.
    • isConstantVolume

      public boolean isConstantVolume()
      Determines if this is a constant volume bar size.
      Returns:
      true if this is a Constant Volume interval bar.
    • isTick

      public boolean isTick()
      Determines if this is a Tick Interval bar (each bar is composed of a constant number of ticks).
      Returns:
      true if this is a Tick Interval bar.
    • isIntervalPoints

      public boolean isIntervalPoints()
      Determines if the interval size is in points vs minimum tick. This is only relevant for bar sizes that are based on price movements (such as Range or Renko)
      Returns:
      true if the interval is expressed in points
    • isBidAsk

      public boolean isBidAsk()
      Determines if this is a bid/ask graph.
      Returns:
      true if this is a bid/ask graph.
    • isHybridRenko

      public boolean isHybridRenko()
      Determines if this is a Hybrid Renko bar. Hybrid Renko is based on Renko bars with a different 'reverse' interval for changing the direction of the bars.
      Returns:
      true if this is a Hybrid Renko bar.
    • isOFAProbe

      public boolean isOFAProbe()
      Determines if this is an OFA bar (OrderFlowAnalytics).
      Returns:
      true if this is an OFA bar.
    • isOFALinear

      public boolean isOFALinear()
      Determines if this is an OFA Linear bar (OrderFlowAnalytics).
      Returns:
      true if this is an OFA Linear bar.
    • isOFA

      public boolean isOFA()
      Returns:
      true if this is an OFA Probe or OFA Linear Bar
    • equals

      public boolean equals(Object o)
      Compares this bar size with the given object and returns true if they are equal.
      Overrides:
      equals in class Object
      Parameters:
      o - object to compare to
      Returns:
      true if this object equals the given object
    • getName

      public String getName()
      Gets the display name for this bar size.
      Returns:
      the name for this bar size
    • getShortName

      public String getShortName()
      Gets a shortened form of the display name for this bar size.
      Returns:
      short name of this bar size
    • toString

      public String toString()
      Returns a printable string representation of this bar size (see getName())
      Overrides:
      toString in class Object
      Returns:
      printable string representation of this bar size
    • compareTo

      public int compareTo(BarSize bs)
      Specified by:
      compareTo in interface Comparable<BarSize>
    • getBarSize

      public static BarSize getBarSize(int interval)
      Gets the linear BarSize with the given interval in minutes.
      Parameters:
      interval - in minutes
    • getBarSize

      public static BarSize getBarSize(Enums.BarSizeType type, int interval)
      Gets the BarSize with the given type and interval.
      Parameters:
      type - bar size type
      interval - dependent on bar size type (minutes for linear bar, ticks for Renko etc)
    • getBarSize

      public static BarSize getBarSize(Enums.BarSizeType type, int interval, boolean intervalPoints)
      Gets the BarSize with the given type and interval.
      Parameters:
      type - bar size type
      interval - dependent on bar size type (minutes for linear bar, ticks for Renko etc)
      intervalPoints - true if inteval is points (pips) instead of min tick
    • getBarSize

      public static BarSize getBarSize(Enums.BarSizeType type, Enums.IntervalType intervalType, int interval)
      Gets the BarSize with the given minutes and interval.
    • getBarSize

      public static BarSize getBarSize(Enums.BarSizeType type, Enums.IntervalType intervalType, int interval, boolean intervalPoints)
      Gets the BarSize with the given minutes and interval.
    • getBarSize

      public static BarSize getBarSize(Enums.BarSizeType type, int interval, int reverseInterval)
      Gets the BarSize with the given minutes and interval.
    • getBarSize

      public static BarSize getBarSize(Enums.BarSizeType type, int interval, int reverseInterval, boolean intervalPoints)
      Gets the BarSize with the given minutes and interval.
    • getBarSize

      public static BarSize getBarSize(Enums.BarSizeType type, Enums.IntervalType intervalType, int interval, int reverseInterval)
      Gets the BarSize with the given interval and reverse interval.
    • getBarSize

      public static BarSize getBarSize(Enums.BarSizeType type, Enums.IntervalType intervalType, int interval, int reverseInterval, boolean intervalPoints)
      Gets the BarSize with the given interval and reverse interval.