WebCab Technical Analysis
v1.1
(J2SE Edition)

webcab.lib.finance.trading.indicators
Class Aroon

java.lang.Object
  |
  +--webcab.lib.finance.trading.indicators.Aroon
All Implemented Interfaces:
Serializable

public class Aroon
extends Object
implements Serializable

Defines a range of Aroon indicators which were originally developed by Tushar Chande in order to establish whether a price is trending or within a trading range. The Aroon indicator is made up of the Aroon Down indicator and the Aroon Up indicator and together are said to form the Aroon indicator. We also provide the Aroon Oscillator within this component.

The determination of whether a market is trending and within a trading range is a key difficulty is the development of trading systems. The Aroon indicator has been developed in order to indicate when a trending approach such as moving averages or the trading range approach such as the application of oscillators in more appropriate.

Interpretation

Interpretation of the Aroon indicator depends on identifying one of the following three scenarios:

For more information on the Aroon indicator see the article written by Tushar Chande in the September 1995 issue of Technical Analysis of Stocks and Commodities.

One Period and Multi Period Versions

For many of the indicators we provide essentially two versions of the same method. The first version evaluates the indicator over the entire period given and the second version evaluates the indicator over all the sub-periods of a given length. Moreover, the version which evaluates over all sub-periods of a given length will return the results as an array where the 1st term of the array will be the value associated with the most resent sub-period, and the previous element corresponding to the previous sub-period and so on.

The naming of these two versions will follow the convention that if the indicator which evaluates over the entire period and returns a single element is named ABCIndicator, then the corresponding indicator over all sub-periods (of a given length) which returns an array will be denoted by ABCIndicatorOverPeriod.

For example, if our source data has N elements then the two versions of a given indicator, where the number of periods used within the sub-periods is n would correspond to:

  1. ABCIndicator - Evaluation of the indicator over the whole period of length N.
  2. ABCIndicatorOverPeriod - Will return an array where the first term is the value of the indicator ABCIndicator on the most recent n periods, and the next term is the value of the indicator ABCIndicator on the previous n+1 periods minus the most recent period and so on. That is, for each iterative evaluation 'the window of evaluation' is shifted one place back.

See Also:
Serialized Form

Constructor Summary
Aroon()
          Creates a new instance.
 
Method Summary
 double aroonDown(double[] lows)
          Calculates the Aroon Down indicator which measures the relative time since the last lowest low for all periods for which sufficient data is provided.
 double[] aroonDownOverPeriod(double[] lows, int periods)
          Calculates the Aroon Down indicator which measures the relative time since the last lowest low for all periods for which sufficient data is provided.
 double aroonOscillator(double[] lows, double[] highs)
          Evaluates the Aroon Oscillator over a period using over price data.
 double aroonOscillator(double aroonUpIndicator, double aroonDownIndicator)
          Evaluates the Aroon Oscillator over a given period.
 double[] aroonOscillatorOverPeriod(double[] aroonUp, double[] aroonDown)
          Evaluates the Aroon Oscillator over all periods where sufficient historical data is provided.
 double[] aroonOscillatorOverPeriod(double[] highs, double[] lows, int length)
          Evaluates the Aroon Oscillator over all periods where sufficient historical data is provided using only price data.
 double aroonUp(double[] highs)
          Evaluates the Aroon Up indicator which measures the relative time since the last highest high.
 double[] aroonUpOverPeriod(double[] highs, int period)
          Evaluates the Aroon Up indicator which measures the relative time since the last highest high for all periods for which sufficient data is provided.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Aroon

public Aroon()
Creates a new instance.

Method Detail

aroonUp

public double aroonUp(double[] highs)
Evaluates the Aroon Up indicator which measures the relative time since the last highest high. The indicator will return a value between 0 and 100, where a higher value indicates that the highest high was achieved more recently. Persistent values between 70 and 100 are said to indicate strength in the asset and in conjunction with a low range (i.e. 0-30) in the Aroon Down indicator, indicates an upward trend.

Evaluation

The Aroon Up indicator is given by:

Aroon Up Indicator = 100 * (n - (number of periods since last highest high over n periods) ) / n,

where n is the number of periods being considered (a reasonable default value for n is 14).

Parameters:
highs - an array of the trading highs over the last n-periods where the k-th terms of the array if the trading high on the k-th previous period.
Returns:
Double value of the Aroon Up Indicator for the latest trading period.
Throws:
IllegalArgumentException - thrown if the highs array is empty.
See Also:
aroonUpOverPeriod - this indicator is a generalization of this indicator and calculates the values of the Aroon Up indicator over all sub-periods of a given length for all possible periods for which sufficient historical data is provided.

aroonUpOverPeriod

public double[] aroonUpOverPeriod(double[] highs,
                                  int period)
Evaluates the Aroon Up indicator which measures the relative time since the last highest high for all periods for which sufficient data is provided. This indicator for each period will return a value between 0 and 100, where a higher value indicates that the highest high was achieved more recently. Persistent values between 70 and 100 are said to indicate strength in the asset and in conjunction with a low range (i.e. 0-30) of the Aroon Down indicator, indicates an upward trend.

Evaluation

The Aroon Up indicator for each period is given by:

Aroon Up Indicator = 100 * (n - (number of periods since last highest high over n periods) ) / n,

where n is the number of periods being considered (a reasonable default value for n is 14).

Parameters:
highs - an array where the k-th term is the trading high over the k-th previous period.
period - an integer which represents the length of the period over which the indicator will be iteratively evaluated.
Returns:
Returns of double array where the first term is the value of the Aroon Up indicator over the earliest set of consecutive periods on length period, and the second term is the value of the indicator over the next set of the consecutive periods (i.e. the windows is moved one place along), and so on.
Throws:
IllegalArgumentException - thrown is the highs array is empty, the array period is not a strictly positive integer or if it is greater than the length of the array highs.
See Also:
aroonUp - this indicator is a special case of aroonUpOverPeriod indicator and calculates the Aroon Up indicator for a single period.

aroonDown

public double aroonDown(double[] lows)
Calculates the Aroon Down indicator which measures the relative time since the last lowest low for all periods for which sufficient data is provided. This indicator for each period will return a value between 0 and 100, where a higher value indicates that the lowest low was achieved more recently. Persistent values between 70 and 100 are said to indicate weakness in the asset and in conjunction with a low range (i.e. 0-30) in the Aroon Up indicator, indicates an downward trend.

Evaluation

The Aroon Down indicator is given by:

Aroon Down Indicator = 100 * (n - (number of periods since last highest high over n periods) ) / n,

where n is the number of periods being considered (a reasonable default value for n is 14).

Parameters:
lows - an array of the trading lows over the last n-periods where the k-th terms of the array if the trading low on the k-th previous period.
Returns:
Double value of the Aroon Down Indicator for the latest trading period.
Throws:
IllegalArgumentException - thrown when the lows array is empty.
See Also:
aroonDownOverPeriod - this indicator is a generalization of {@link #aroonDown aroonDown} indicator and calculates the values of the Aroon Down indicator over all sub-periods of a given length for all possible periods for which sufficient historical data is provided.

aroonDownOverPeriod

public double[] aroonDownOverPeriod(double[] lows,
                                    int periods)
Calculates the Aroon Down indicator which measures the relative time since the last lowest low for all periods for which sufficient data is provided. The indicator for each period will return a value between 0 and 100, where a higher value indicates that the lowest low was achieved more recently. Persistent values between 70 and 100 are said to indicate weakness in the asset and in conjunction with a low range (i.e. 0-30) in the Aroon Up indicator, indicates an downward trend.

Evaluation

The Aroon Down indicator for each period is given by:

Aroon Down Indicator = 100 * (n - (number of periods since last highest high over n periods) ) / n,

where n is the number of periods being considered (a reasonable default value for n is 14).

Parameters:
lows - an array where the first term is the traded high of the asset within the most recent trading period, the second term is the traded high of the asset within the previous period and so on.
periods - an integer which represents the length of the period over which the indicator will be iteratively evaluated.
Returns:
Returns of double array where the first term is the value of the Aroon Down indicator over the earliest set of consecutive periods on length period, and the second term is the value of the indicator over the next set of the consecutive periods (i.e. the windows is moved one place along), and so on.
Throws:
IllegalArgumentException - thrown when the lows array is empty, the length is not a strictly positive integer or if it is greater than the length of the array lows.
See Also:
aroonDown - this indicator is a special case of {@link #aroonDownOverPeriod aroonDownOverPeriod} and calculates the Aroon Down indicator for a single period.

aroonOscillator

public double aroonOscillator(double aroonUpIndicator,
                              double aroonDownIndicator)
Evaluates the Aroon Oscillator over a given period.

Evaluation

The Aroon Oscillator over a given period is evaluated using the following formulae:

Aroon Oscillator = (Aroon Up Indicator) - (Aroon Down Indicator),

where 'Aroon Up Indicator' can be evaluated using aroonUp, and 'Aroon Down Indicator' can be evaluated using aroonDown, where the same number of periods is used in the evaluation of each indicator.

Parameters:
aroonUpIndicator - the value of the Aroon Up Indicator for the period considered which can be evaluated using aroonUp
aroonDownIndicator - the value of the Aroon Down Indicator for the period considered which can be evaluated using aroonDown
Returns:
The double value of the Aroon Oscillator over a given period.
See Also:
aroonOscillatorOverPeriod - evaluates the Aroon Oscillator over all periods for which sufficient historical data is provided.

aroonOscillatorOverPeriod

public double[] aroonOscillatorOverPeriod(double[] aroonUp,
                                          double[] aroonDown)
Evaluates the Aroon Oscillator over all periods where sufficient historical data is provided.

Evaluation

The Aroon Oscillator over each period is evaluated using the following formulae:

Aroon Oscillator = (Aroon Up Indicator) - (Aroon Down Indicator),

where 'Aroon Up Indicator' can be evaluated using aroonUp, and 'Aroon Down Indicator' can be evaluated using aroonDown, where the same number of periods is used in the evaluation of each indicator.

Parameters:
aroonUp - an array where the first term is the Aroon Up Oscillator over the most recent period, the second term of the oscillator over the previous period and so on. Please note that the value of the Aroon Up Indicator over each period can be evaluated using aroonUp(double[]), alternatively you may evaluate the indicator over all periods using aroonUpOverPeriod.
aroonDown - an array where the first term is the Aroon Down indicator over the most recent period, the second term of the Aroon Down indicator over the previous period and so on. Please note that the value of the Aroon Down Indicator over each period can be evaluated using aroonDown(double[]), alternatively you may evaluate the indicator over all periods for the data provided using aroonDownOverPeriod.
Returns:
An array where the k-th term is the value of the Aroon Oscillator over the k-th previous period.
Throws:
IllegalArgumentException - thrown when the array parameters aroonUp and aroonDown are empty or the lengths of these two arrays are not equal.
See Also:
aroonOscillator

aroonOscillator

public double aroonOscillator(double[] lows,
                              double[] highs)
Evaluates the Aroon Oscillator over a period using over price data.

Evaluation

The Aroon Oscillator over each period is evaluated using the following formulae:

Aroon Oscillator = (Aroon Up Indicator) - (Aroon Down Indicator),

where 'Aroon Up Indicator' can be evaluated using aroonUp, and 'Aroon Down Indicator' can be evaluated using aroonDown, where the same number of periods is used in the evaluation of each indicator.

Parameters:
lows - an array where the first term is the traded low of the asset within the most recent trading period, the second term is the traded low of the asset within the previous period and so on.
highs - an array where the first term is the traded high of the asset within the most recent trading period, the second term is the traded high of the asset within the previous period and so on.
Returns:
Returns the double value of the Aroon Oscillator over the period considered.
Throws:
IllegalArgumentException - thrown when the array parameters lows and highs are empty or the lengths of these two arrays are not equal.
See Also:
aroonOscillatorOverPeriod - calculates the values of the Aroon Oscillator indicator over all sub-periods of a given length.

aroonOscillatorOverPeriod

public double[] aroonOscillatorOverPeriod(double[] highs,
                                          double[] lows,
                                          int length)
Evaluates the Aroon Oscillator over all periods where sufficient historical data is provided using only price data.

Evaluation

The Aroon Oscillator over each period is evaluated using the following formulae:

Aroon Oscillator = (Aroon Up Indicator) - (Aroon Down Indicator),

where the 'Aroon Up Indicator' can be evaluated using aroonUp, and 'Aroon Down Indicator' can be evaluated using aroonDown, where the same number of periods is used in the evaluation of each indicator. Formally speaking the Aroon Up and Aroon Down indicators are given by the following formulae.

The Aroon Up indicator is given by:

Aroon Up Indicator = 100 * (n - (number of periods since last highest high over n periods) ) / n,

where n is the number of periods being considered (a reasonable default value for n is 14).

The Aroon Down indicator is given by:

Aroon Down Indicator100 * (n - (number of periods since last highest high over n periods) ) / n.

where n is the number of periods being considered (a reasonable default value for n is 14).

Parameters:
lows - an array where the first term is the traded low of the asset within the most recent trading period, the second term is the traded low of the asset within the previous period and so on.
highs - an array where the first term is the traded high of the asset within the most recent trading period, the second term is the traded high of the asset within the previous period and so on.
length - an integer which represents the length of the period over which the indicator will be iteratively evaluated.
Returns:
An array where the first term is the value of the Aroon Oscillator for the most recent period, the second term is the value of the Aroon Oscillator for the previous period and so on.
Throws:
IllegalArgumentException - thrown when the 'lows' or 'highs' array is empty or not equal, the length is not a strictly positive integer or if it is greater than the length of the array lows.

WebCab Technical Analysis
v1.1
(J2SE Edition)