|
WebCab Technical Analysis v1.1 (J2SE Edition) |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--webcab.lib.finance.trading.indicators.AccumulateDistribute
Provides indicators which measure to what degree an asset is being accumulated (brought) or distributed (sold) by the market as a whole.
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 recent 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:
ABCIndicator - Evaluation of the indicator over the whole period of length N.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.
| Constructor Summary | |
AccumulateDistribute()
Creates a new instance. |
|
| Method Summary | |
double[] |
accumulateDistributionOverPeriod(double[] high,
double[] low,
double[] volume,
int lengthOfPeriod)
Evaluates the accumulation/distribution indicator for each of the (sub)collection of periods of a given length. |
double |
accumulationDistribution(double high,
double low,
double volume)
The accumulation/distribution indicator illustrates the degree to which an asset is being accumulated or reduced by the market on a given period. |
double |
accumulationDistributionPeriod(double[] highs,
double[] lows,
double[] volume)
Evaluates the accumulation/distribution indicator over a number of periods. |
double |
chaikinMoneyFlow(double[] high,
double[] low,
double[] closing,
double[] volume)
Chaikin Money Flow (CMF) is a volume weighted average of Accumulation/Distribution over a specified period, which is usually taken to be 21 days. |
double[] |
chaikinMoneyFlowOverPeriod(double[] high,
double[] low,
double[] close,
double[] volume,
int lengthOfPeriod)
Iteratively evaluates the Chaikin Money Flow (CMF) indicator over all (sub)collections of periods of a given length for all periods for which data is provided. |
double |
chaikinOscillator(double[] high,
double[] low,
double[] volume,
double smoothingFactor)
Implements the Chaikin Oscillator (also known as the Chaikin A/D Oscillator) and evaluates this indicator for the latest period. |
double[] |
chaikinOscillatorOverPeriod(double[] high,
double[] low,
double[] volume,
double smoothingFactor)
Implements the Chaikin Oscillator (also known as the Chaikin A/D Oscillator) and evaluates this indicator for the latest and all previous periods for which there exists sufficient data. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public AccumulateDistribute()
| Method Detail |
public double accumulationDistribution(double high,
double low,
double volume)
A divergence between the price action and this indicator can signal that a trend is nearing completion, a trends continuation and imminent break-outs from trading ranges. The actual value of this indicator is of no significance, what is significant is its change in value relative to the previous periods which can warn of a possible break-out during a trading range (falling/rising indicator), the continuation of a trend (higher highs in uptrend, or lower lows in downtrend) or a change/completion of a trend (divergence between the price action and the direction of the indicator).
high - the intra-period high for the given period under considerationlow - the intra-period low for the given period under considerationvolume - the days volume for the given period under consideration
IllegalArgumentException - thrown if any of the parameters are strictly negative
numbers.accumulationDistributionPeriod - a slight variation which measures the Accumulation/Distribution over a period.
public double accumulationDistributionPeriod(double[] highs,
double[] lows,
double[] volume)
Remark: This indicator is a slight generalization of the accumulationDistribution(double, double, double)
indicator. Here the indicator may be evaluated with respect to a period of a days
rather than with respect to a one day period.
A divergence between the price action and this indicator can signal that a trend is nearing completion, a trends continuation and break-outs from trading ranges. The actual value of this indicator is of no significance, what is significant is its change in value relative to the previous periods which can warn of a possible break-out during a trading range (falling/rising indicator), the continuation of a trend (higher highs in uptrend, or lower lows in downtrend) or a change/completion of a trend (divergence between the price action and the direction of the indicator).
highs - an array where the first term is the intraday high over the most recent period, the second term is the high over the previous period and so on.lows - an array where the first term is the intraday low over the most recent periods, the second term is the high over the previous period and so on.volume - an array where the first terms is the trading volume of the asset considered over the most recent periods, the second term is the volume over the previous period and on so.
IllegalArgumentException - throw when the three arrays highs, lows, volume do not have the
same length, or when any element of these three arrays is a strictly negative number.accumulationDistribution
public double[] accumulateDistributionOverPeriod(double[] high,
double[] low,
double[] volume,
int lengthOfPeriod)
A divergence between the price action and this indicator can signal that a trend is nearing completion, a trends continuation and break-outs from trading ranges. The actual value of this indicator is of no significance, what is significant is its change in value relative to the previous periods which can warn of a possible break-out during a trading range (falling/rising indicator), the continuation of a trend (higher highs in uptrend, or lower lows in downtrend) or a change/completion of a trend (divergence between the price action and the direction of the indicator).
Say for example we know that:
Highs = {3, 4, 3, 4, 5}, i.e. 3 is the high from the latest period.Lows = {2, 1, 2, 1, 3}, i.e. 2 is the low from the latest period.Volume = {300, 290, 295, 285, 290}, i.e. 300 is the volume in the latest period.Now if the lengthOfPeriod considered is 4, then this method will return an array
of length two where the first term is the accumulation\distribution indicator (evaluated using
accumulationDistribution) when:
Highs = {3, 4, 3, 4}, i.e. above Highs with the last element removed.Lows = {2, 1, 2, 1}, i.e. above Highs with the last element removed.Volume = {300, 290, 295, 285} i.e. above Highs with last element removed.Highs = {4, 3, 4, 5}, i.e. the window moves one position back.Lows = {1, 2, 1, 3}, i.e. the window moves one position back.Volume = {290, 295, 285, 290}, i.e. the window moves one position back.
high - an array where the first term is the intraday high over the most recent period, the second term is the high over the previous period and so on.low - an array where the first term is the intraday low over the most recent periods, the second term is the high over the previous period and so on.volume - an array where the first terms is the trading volume of the asset considered over the most recent periods, the second term is the volume over the previous period and on so.lengthOfPeriod - an integer which represents the number of periods within each of the (sub)collection of periods over which the indicator is evaluated.
IllegalArgumentException - throw when the three arrays highs, lows, volume do not have the
same length, or when any element of these three arrays is a strictly negative number.accumulationDistribution - measure the accumulate/distribution on an asset
over a single trading period.
public double chaikinOscillator(double[] high,
double[] low,
double[] volume,
double smoothingFactor)
A sell signal is when price action develops a higher high into overbought zones and the Chaikin Oscillator diverges with a lower high and begins to fall. Conversely, a buy signal is generated when price action develops a lower low into oversold zones and the oscillator diverges with a higher low and begins to rise. The Chaikin Oscillator can also be used to time entry to existing trends by either buying the dip (when the oscillator turns down) or selling the rally (when the oscillator turns up).
The Chaiken Oscillator is given by:
Chaiken Oscillator = EMA3(Accumulate/Distribution) - EMA10(Accumulate/Distribution),
where EMA3 and EMA10 is the exponential moving average over 3 and
10 days respectively; and Accumulate/Distribution is the corresponding indicator over
those 3 or 10 days respectively.
high - an array of 10 elements where the first term is the high in the last trading period, the second term is the high in the trading period before that, and so onlow - an array of 10 elements where the first term is the low in the last trading period, the second term is the low in the trading period before that, and so onvolume - an array of 10 elements where the first term is the volume in the last trading period, the second term is the volume in the trading period before that, and so onsmoothingFactor - the number between 0 and 1. The lower the number the more sensitive the moving average is.
IllegalArgumentException - thrown when the three arrays high, low, volume do not have
the same length and when the smoothing factor does not lie within the closed interval [0,1].chaikinOscillatorOverPeriod - a slight generalization of this indicator,
here the indicator may be evaluated with respect to a period of a days. This method implements the
Chaikin Oscillator over a period (also known as the Chaikin A/D Oscillator).
public double[] chaikinOscillatorOverPeriod(double[] high,
double[] low,
double[] volume,
double smoothingFactor)
A sell signal is when price action develops a higher high into overbought zones and the Chaikin Oscillator diverges with a lower high and begins to fall. Conversely, a buy signal is generated when price action develops a lower low into oversold zones and the oscillator diverges with a higher low and begins to rise. The Chaikin Oscillator can also be used to time entry to existing trends by either buying the dip (when the oscillator turns down) or selling the rally (when the oscillator turns up).
The Chaiken Oscillator for a given period is given by:
Chaiken Oscillator = EMA3(Accumulate/Distribution) - EMA10(Accumulate/Distribution),
where EMA3 and EMA10 is the exponential moving average over 3
and 10 days respectively; and Accumulate/Distribution is the corresponding indicator over
those 3 or 10 days respectively.
If we are provided within the high, low and volume over the last 15 periods, then
we will be able to evaluate the Chaikin Oscillator on the previous 5 trading days.
Since the evaluation of the oscillator on a given period requires knowledge of the
10 previous periods data.
high - an array of at least 10 elements where the first term is the high in the last trading period, the second term is the high in the trading period before that, and so onlow - an array of at least 10 elements where the first term is the low in the last trading period, the second term is the low in the trading period before that, and so onvolume - an array of at least 10 elements where the first term is the volume in the last trading period, the second term is the volume in the trading period before that, and so onsmoothingFactor - the number between 0 and 1. The lower the number the more sensitive the indicator is.
10 days data,
the previous term is the value of the oscillator on the previous period and so on.
IllegalArgumentException - thrown when the three arrays high, low, volume do not have
the same length and when the smoothing factor does not lie within the closed interval [0,1].chaikinOscillator
public double chaikinMoneyFlow(double[] high,
double[] low,
double[] closing,
double[] volume)
21 days. The CMF offers a
volume weighted indicator on the following two principles:
A sell signal is generated in positive over brought territory when higher highs diverge into a lower high and the indicator continues to decrease. Conversely, a buy signal in generated in negative oversold territory when lower lows diverge into a high low and the indicator continues to increase.
The CMF indicator can be used as a confirmation signal after a breakout of a trading range. When a market breaks higher then the breakout is confirmed if the CMF moves into positive territory and continues to get stronger. Conversely, if the market down after a trading range then the breakout if confirmed if the CMF move into negative territory and continues to weaken.
The CMF indicator is evaluated for the following steps:
( ( (Close - Low) - (High - Close) ) / (High - Low) ) * Volume
high - an array where the first term in the high in the latest trading period and the second term is the high in the previous trading periods and so on... Until the last term which is the highest market price during the first period which is used in the evaluation of the CMF indicatorlow - an array where the first term in the low in the latest trading period and the second term is the low in the previous trading periods and so on... Until the last term which is the lowest market price during the first period which is used in the evaluation of the CMF indicator.closing - an array where the first term is the closing price in the latest trading period and the second term is the closing price in the previous trading periods and so on... Until the last term which is the closing price during the first period which is used in the evaluation of the CMF indicatorvolume - an array where the first term in the volume in the securities latest trading period and the second term is the securities volume in the previous trading periods and so on... Until the last term which is the securities volume during the first period which is used in the evaluation of the CMF indicator
IllegalArgumentException - thrown if the arrays high, low, close, volume do not have
the same length or if any element of these arrays is a strictly negative number.chaikinMoneyFlowOverPeriod - a slight generalization of this
indicator, in that here we iteratively evaluate the Chaikin Money Flow (CMF) indicator over periods.
public double[] chaikinMoneyFlowOverPeriod(double[] high,
double[] low,
double[] close,
double[] volume,
int lengthOfPeriod)
Note: The form in which the Chaikin Money Flow (CMF) in provided here is particularly suitable when wishing to integrated this functionality within a Client side GUI Charting Application.
Chaikin Money Flow (CMF) is a volume weighted average of Accumulation/Distribution over
a specified period, which is usually taken to be 21 days. The CMF offers a volume weighted
indicator on the following two principles:
The CMF indicator is evaluated for the following steps:
( ( (Close - Low) - (High - Close) ) / (High - Low) ) * VolumeWithin this example we illustrate the way this method works when we consider a given 10 period in which the length of period over which the CHM is evaluated is 4. In this case the result will be an array of 7 elements as follows:
result[0]: CMF calculated over the last four periods
result[1]: CMF calculated over previous four periods
result[7]: CMF calculated using the periods between the earliest period and
the fourth from earliest period.
high - an array where the first term in the high in the latest trading period and the second term is the high in the previous trading periods and so on... Until the last term which is the highest market price during the first period which is used in the evaluation of the CMF indicatorlow - an array where the first term in the low in the latest trading period and the second term is the low in the previous trading periods and so on... Until the last term which is the lowest market price during the first period which is used in the evaluation of the CMF indicator.close - an array where the first term is the closing price in the latest trading period and the second term is the closing price in the previous trading periods and so on... Until the last term which is the closing price during the first period which is used in the evaluation of the CMF indicatorvolume - an array where the first term in the volume in the securities latest trading period and the second term is the securities volume in the previous trading periods and so on... Until the last term which is the securities volume during the first period which is used in the evaluation of the CMF indicatorlengthOfPeriod - an integer which represents the number of periods over which the indicator is calculated
IllegalArgumentException - thrown if the arrays high, low,
lose, volume do not have the same length or if any element of
these arrays is a strictly negative number.chaikinMoneyFlow - evaluates the Chaikin Money Flow for the last period only.
|
WebCab Technical Analysis v1.1 (J2SE Edition) |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||