com.exponto.jstock.indicators
Interface IndicatorInterface

All Known Implementing Classes:
Indicator

public interface IndicatorInterface

The IndicatorInterface defines how the rest of the applications should interact with different indicators. It is assumed that indicators has a valid start and stop date that is dervied from the input data to the indicator (LogDataSeries) and indicator spesific parameters (e.g. a Moving Average computed over 200 days, will not be valid for the first 200 days in a LogDataSeries.). Further more it is required that the indicator can display itself correctly on the screen, based on the size of the JPanel (or possibly the Graphics2D) and the width of candlesticks. It is also required that a indicator can give information about a particular day. Mouse and/or keyboard input is currently not part of this interface Note that the daily LogDataSeries assumes that all weeks has five valid days.

Author:
kaare

Method Summary
 boolean drawWithCandleSticks()
          Information for the class that allocates screenspace wheter a particular indicator requires a separate screen space or if it shall be painted with the candlesticks.
 java.lang.String getDailyPrintOut(int n)
          Makes a String with name, parameters and value (e.g.
 IndicatorParameters getIndicatorParameters()
          This returns the one and only IndicatorParameter used together with a specific indicator.
 boolean hasChanged()
          Check if the calling class can use data obtained from a previous call to paintIndicator or not.
 void initiateIndicator(LogDataSeries lDS)
          Initiates an indicator with the provided LogDataSeries combined with indicator spesific parameters either provied from a properties file or the user.
 void initiateIndicator(LogDataSeries lDS, IndicatorParameters indParam)
          As above but with Indicatorparameters provided directly
 void paintIndicator(java.awt.Graphics2D g2d, GraphicsParameters gP)
          Sends the Indicator a Graphics2D and asks it to paint itself on that Graphics.
 java.lang.String[] printAll(int number)
          Generates an Array of strings that is suitable for printing to file or debugging purposes with all data within the range.
 boolean supportIndicatorValuesInterface()
          Return true if theIndicatorValuesInterface is implemented for this class.
 

Method Detail

getIndicatorParameters

public IndicatorParameters getIndicatorParameters()
This returns the one and only IndicatorParameter used together with a specific indicator. That is even if each and every chart has a seperate instance of the indicator class, all this instances have to share the indicator parameters.

Returns:
the IndicatorParameter associated with the specific indicator.

initiateIndicator

public void initiateIndicator(LogDataSeries lDS)
Initiates an indicator with the provided LogDataSeries combined with indicator spesific parameters either provied from a properties file or the user.

Parameters:
lDS - The LogDataSeries containg values to computes the indicator

initiateIndicator

public void initiateIndicator(LogDataSeries lDS,
                              IndicatorParameters indParam)
As above but with Indicatorparameters provided directly

Parameters:
lDS -
indParam -

drawWithCandleSticks

public boolean drawWithCandleSticks()
Information for the class that allocates screenspace wheter a particular indicator requires a separate screen space or if it shall be painted with the candlesticks.

Returns:
true if this indicator shall be drawn in the same panel as the candlesticks, false if it shall be drawn in a separate panel

hasChanged

public boolean hasChanged()
Check if the calling class can use data obtained from a previous call to paintIndicator or not. The intention is that the calling class may store the graphs in an image in order to speed up the drawing time (at the cost of memory)

Returns:
true if the parameters for this indicator has changed, false otherwise

paintIndicator

public void paintIndicator(java.awt.Graphics2D g2d,
                           GraphicsParameters gP)
Sends the Indicator a Graphics2D and asks it to paint itself on that Graphics.

Parameters:
g2d - the Graphics to paint on

getDailyPrintOut

public java.lang.String getDailyPrintOut(int n)
Makes a String with name, parameters and value (e.g. "RSI(14): 74") that can be used to print information about a particular day on screen. The Indicators them self has only indirect knowledge about dates other than start and stop date for the indicator, so the indicator number displayed on screen are used. 0 is the leftmost visible indicator.

Parameters:
n - the number of day (0 is the first visible day on screen
Returns:
a String with Indicator name and value(s) that may be displayed on screen

printAll

public java.lang.String[] printAll(int number)
Generates an Array of strings that is suitable for printing to file or debugging purposes with all data within the range. There shall be one String per timeperiode (e.g. one per day for daily charts). A header String may also be generated. Note that the start and stop values shall be based on the original LogDataSeries and not the indicator series. If the indicatorSeries has no valid data for parts of the series "not valid" may be printed.

Parameters:
number - of values to print, starting from the latest
Returns:
a String array with all values within the range

supportIndicatorValuesInterface

public boolean supportIndicatorValuesInterface()
Return true if theIndicatorValuesInterface is implemented for this class.

Returns:
true if the IndicatorValuesInterface is supporteted, false otherwise.


Copyright © 2004 Kaare Ranum