com.exponto.jstock.indicators
Class Rsi

java.lang.Object
  extended bycom.exponto.jstock.indicators.Indicator
      extended bycom.exponto.jstock.indicators.Rsi
All Implemented Interfaces:
IndicatorInterface, IndicatorLinesInterface, IndicatorValuesInterface

public class Rsi
extends Indicator
implements IndicatorValuesInterface, IndicatorLinesInterface

Author:
kaare

Field Summary
protected  java.util.ArrayList m_indicatorSeries
           
 
Fields inherited from class com.exponto.jstock.indicators.Indicator
sm_indicatorColor, sm_indicatorName, sm_isDisplayed
 
Constructor Summary
Rsi()
           
 
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.
 IndicatorAxisInfo getIndicatorAxisInfo()
           
 IndicatorParameters getIndicatorParameters()
          This returns the 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 specific parameters either provied from a properties file or the user.
 void initiateIndicator(LogDataSeries lDS, java.lang.String indParam)
          As above but with Indicatorparameters provided in a string format.
 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[] parameters()
          Gives the calling class a list of parameters that is available.
 java.lang.String[] parametersToolTip()
          Gives the calling class a string array with tool tips that can be presented to the user.
 java.lang.Double parameterValue(java.lang.String str)
          Returns the value for the last day of the requested parameter.
 java.lang.Double parameterValue(java.lang.String str, int index)
          Returns the value for the last day minus index of the requested parameter.
 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.
 java.lang.String toString()
           
 
Methods inherited from class com.exponto.jstock.indicators.Indicator
displayNumberToArrayIndex, getColor, getDisplayed, getIndicatorName, isMainIndicator, setColor, setDisplayed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_indicatorSeries

protected java.util.ArrayList m_indicatorSeries
Constructor Detail

Rsi

public Rsi()
Method Detail

getIndicatorParameters

public IndicatorParameters getIndicatorParameters()
Description copied from interface: IndicatorInterface
This returns the IndicatorParameter used together with a specific indicator. If none is specifically defined in the class, the default static indicatorparameter is returned.

Specified by:
getIndicatorParameters in interface IndicatorInterface
Specified by:
getIndicatorParameters in class Indicator

initiateIndicator

public void initiateIndicator(LogDataSeries lDS)
Description copied from interface: IndicatorInterface
Initiates an indicator with the provided LogDataSeries combined with indicator specific parameters either provied from a properties file or the user.

Specified by:
initiateIndicator in interface IndicatorInterface
Specified by:
initiateIndicator in class Indicator

initiateIndicator

public void initiateIndicator(LogDataSeries lDS,
                              java.lang.String indParam)
Description copied from interface: IndicatorInterface
As above but with Indicatorparameters provided in a string format. The string will be passed on to a new instance of indicatorParameters for decoding.

Specified by:
initiateIndicator in interface IndicatorInterface
Specified by:
initiateIndicator in class Indicator

drawWithCandleSticks

public boolean drawWithCandleSticks()
Description copied from interface: IndicatorInterface
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.

Specified by:
drawWithCandleSticks in interface IndicatorInterface
Specified by:
drawWithCandleSticks in class Indicator

hasChanged

public boolean hasChanged()
Description copied from interface: IndicatorInterface
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 graphics in an image in order to speed up the drawing time (at the cost of memory)

Specified by:
hasChanged in interface IndicatorInterface
Specified by:
hasChanged in class Indicator

paintIndicator

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

Specified by:
paintIndicator in interface IndicatorInterface
Specified by:
paintIndicator in class Indicator

getDailyPrintOut

public java.lang.String getDailyPrintOut(int n)
Description copied from interface: IndicatorInterface
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.

Specified by:
getDailyPrintOut in interface IndicatorInterface
Specified by:
getDailyPrintOut in class Indicator

toString

public java.lang.String toString()

printAll

public java.lang.String[] printAll(int number)
Description copied from interface: IndicatorInterface
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.

Specified by:
printAll in interface IndicatorInterface
Specified by:
printAll in class Indicator

getIndicatorAxisInfo

public IndicatorAxisInfo getIndicatorAxisInfo()
Specified by:
getIndicatorAxisInfo in interface IndicatorLinesInterface

supportIndicatorValuesInterface

public boolean supportIndicatorValuesInterface()
Description copied from interface: IndicatorInterface
Return true if theIndicatorValuesInterface is implemented for this class.

Specified by:
supportIndicatorValuesInterface in interface IndicatorInterface
Returns:
true if the IndicatorValuesInterface is supporteted, false otherwise.

parameters

public java.lang.String[] parameters()
Description copied from interface: IndicatorValuesInterface
Gives the calling class a list of parameters that is available. The parameters name shall have print quality.

Specified by:
parameters in interface IndicatorValuesInterface
Returns:
a string array of the parameters that is available

parametersToolTip

public java.lang.String[] parametersToolTip()
Description copied from interface: IndicatorValuesInterface
Gives the calling class a string array with tool tips that can be presented to the user. It is crucial that the tool tip is in the same order as the parameter name, but null is a valid tool tip. The tool tips shall have print quality.

Specified by:
parametersToolTip in interface IndicatorValuesInterface
Returns:
a string array with tool tip explaing the parameters in more detail

parameterValue

public java.lang.Double parameterValue(java.lang.String str)
Description copied from interface: IndicatorValuesInterface
Returns the value for the last day of the requested parameter. null shall be returned if no value is avaliable. Assumes that all parameters are doubles.

Specified by:
parameterValue in interface IndicatorValuesInterface
Parameters:
str - The name of the parameter
Returns:
the last value of the requested parameter.

parameterValue

public java.lang.Double parameterValue(java.lang.String str,
                                       int index)
Description copied from interface: IndicatorValuesInterface
Returns the value for the last day minus index of the requested parameter. null shall be returned if no value is avaliable. The value of index has to be verified against the real length of the indicatorSeries as the calling class has no idea about that. Assumes that all parameters are doubles.

Specified by:
parameterValue in interface IndicatorValuesInterface
Parameters:
str - The name of the parameter
index - The index
Returns:
the value of the requested parameter for the requested day.


Copyright © 2004 Kaare Ranum