Venice 0.7beta

org.mov.chart.graph
Class CountbackLineGraph

java.lang.Object
  extended by org.mov.chart.graph.AbstractGraph
      extended by org.mov.chart.graph.CountbackLineGraph
All Implemented Interfaces:
Graph

public class CountbackLineGraph
extends AbstractGraph

3 Bar Nett Countback lines. This graph draws a single across a price value which indicates a buy signal if used with highs in a down trend and a sell signal with lows in a new uptrend.

Author:
Mark Hummel
See Also:
CountbackLineGraphUI

Field Summary
static int BREAKOUT
           
static int STOPLOSS
           
 
Fields inherited from interface org.mov.chart.graph.Graph
TOOL_TIP_BUFFER
 
Constructor Summary
CountbackLineGraph(GraphSource low, GraphSource high, GraphSource close)
          Create a new countback line.
 
Method Summary
 Graphable createCountbackLine(Graphable dayHigh, Graphable dayLow, int type)
          Creates a new Countback line based on the given data source.
 double getHighestY(java.util.List x)
          Return the highest Y value in the given X range.
 double getLowestY(java.util.List x)
          Return the loweset Y value in the given X range.
 java.lang.String getName()
          Return the name of this graph.
 java.lang.String getToolTipText(java.lang.Comparable x, int y, int yoffset, double verticalScale, double bottomLineValue)
          Get the tool tip text for the given X value and y coordinate.
 GraphUI getUI(java.util.HashMap settings)
          Return the graph's user interface.
 boolean isPrimary()
          Return whether the graph is a primary graph.
 void render(java.awt.Graphics g, java.awt.Color colour, int xoffset, int yoffset, double horizontalScale, double verticalScale, double bottomLineValue, java.util.List xRange)
          Draw the graph.
 void setSettings(java.util.HashMap settings)
          Set the graph's user definable settings.
 
Methods inherited from class org.mov.chart.graph.AbstractGraph
getAcceptableMajorDeltas, getAcceptableMinorDeltas, getEndX, getSettings, getSource, getSourceName, getStartX, getXRange, getY, getYLabel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BREAKOUT

public static final int BREAKOUT
See Also:
Constant Field Values

STOPLOSS

public static final int STOPLOSS
See Also:
Constant Field Values
Constructor Detail

CountbackLineGraph

public CountbackLineGraph(GraphSource low,
                          GraphSource high,
                          GraphSource close)
Create a new countback line.

Parameters:
source - the source to create a moving average from
Method Detail

render

public void render(java.awt.Graphics g,
                   java.awt.Color colour,
                   int xoffset,
                   int yoffset,
                   double horizontalScale,
                   double verticalScale,
                   double bottomLineValue,
                   java.util.List xRange)
Description copied from interface: Graph
Draw the graph.

Parameters:
g - the Graphics object to render to
colour - the colour the graph should be rendered in; override this if the graph should be drawn in a certain colour - such as a Moving Average graph
xoffset - the x offset in the graphics object where the graph starts
yoffset - the y offset in the graphics object where the graph starts
horizontalScale - horizontal scale factor; use this to convert between X value in the xRange to a cartesian coordinate x
verticalScale - vertical scale factor; use this to convert between Y value to a cartesian coordinate y
bottomLineValue - the Y value of the lowest line in the graph
xRange - a List of Comparable that contain the X values to plot

getToolTipText

public java.lang.String getToolTipText(java.lang.Comparable x,
                                       int y,
                                       int yoffset,
                                       double verticalScale,
                                       double bottomLineValue)
Description copied from class: AbstractGraph
Get the tool tip text for the given X value and y coordinate.

Specified by:
getToolTipText in interface Graph
Overrides:
getToolTipText in class AbstractGraph
Parameters:
x - the X value
y - the y coordinate
yoffset - y offset from top of graph
verticalScale - vertical scale factor
bottomLineValue - the Y value of the lowest line in the graph
Returns:
the tool tip text for the default GraphSource

getHighestY

public double getHighestY(java.util.List x)
Description copied from class: AbstractGraph
Return the highest Y value in the given X range.

Specified by:
getHighestY in interface Graph
Overrides:
getHighestY in class AbstractGraph
Parameters:
x - range of X values
Returns:
the highest Y value of the default GraphSource

getLowestY

public double getLowestY(java.util.List x)
Description copied from class: AbstractGraph
Return the loweset Y value in the given X range.

Specified by:
getLowestY in interface Graph
Overrides:
getLowestY in class AbstractGraph
Parameters:
x - range of X values
Returns:
the lowest Y value of the default GraphSource

getName

public java.lang.String getName()
Return the name of this graph.

Returns:
Exponentially Weighted Moving Average

createCountbackLine

public Graphable createCountbackLine(Graphable dayHigh,
                                     Graphable dayLow,
                                     int type)
Creates a new Countback line based on the given data source.

Parameters:
dayHigh - the graph source of the daily highs
dayLow - the graph source of the daily lows
type - the desired countback line
Returns:
the graphable containing averaged data from the source

isPrimary

public boolean isPrimary()
Description copied from interface: Graph
Return whether the graph is a primary graph. Primary graphs will appear together in the top chart. Secondary graphs appear in their own charts which are added below. The day close graph is primary; while the day close graph is secondary.

Returns:
true if the graph is a primary graph

setSettings

public void setSettings(java.util.HashMap settings)
Description copied from class: AbstractGraph
Set the graph's user definable settings.

Specified by:
setSettings in interface Graph
Overrides:
setSettings in class AbstractGraph
Parameters:
settings - the new settings

getUI

public GraphUI getUI(java.util.HashMap settings)
Return the graph's user interface.

Specified by:
getUI in interface Graph
Overrides:
getUI in class AbstractGraph
Parameters:
settings - the initial settings
Returns:
user interface

Venice 0.7beta