|
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.Volume
Indicators such Negative/Positive Trading Index and On Balance Volume which describe the effects of volume on the price dynamics.
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 | |
Volume()
Creates a new instance. |
|
| Method Summary | |
double[] |
negativeVolumeIndex(double[] closes,
double[] volumes)
Implements the Negative Volume Index (NVI) as introduced by Norman Fosback. |
double[] |
onBalanceVolume(double[] volumes)
Implements the On Balance Volume (OBV) indicator which was introduced by Joe Granville within this book New Strategy of Daily Stock Market Timing for Maximum Profits. |
double[] |
positiveVolumeIndex(double[] closes,
double[] volumes)
Implements the Positive Volume Index (PVI) as introduced by Norman Fosback. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public Volume()
| Method Detail |
public double[] negativeVolumeIndex(double[] closes,
double[] volumes)
The procedure used for the evaluation of this indicator is as follows:
NVI = (Previous Periods NVI) + ( ( (Close - (Previous Close) ) / (Previous Close) ) * (Previous NVI) )NVI = Yesterday's NVI
closes - an array of the trading closing prices over the last n-periods where the k-th terms of the array if the closing price on the k-th previous period.volumes - an array of the trading volumes over the last n-periods where the k-th terms of the array if the trading volume on the k-th previous period.
IllegalArgumentException - thrown if either parameter is strictly negative or arrays closes or
volumes are empty.
public double[] positiveVolumeIndex(double[] closes,
double[] volumes)
The procedure used for the evaluation of this indicator is as follows:
PVI = (Previous Periods PVI) + ( ( (Close - Previous Close) / (Previous Close) ) * Previous PVI)PVI = Previous Periods PVI
closes - an array of the trading closing prices over the last n-periods where the k-th terms of the array if the closing price on the k-th previous period.volumes - an array of the trading volumes over the last n-periods where the k-th terms of the array if the trading volume on the k-th previous period.
IllegalArgumentException - thrown if either parameter is strictly negative or arrays closes or
volumes are empty.public double[] onBalanceVolume(double[] volumes)
The OBV indicator is evaluated in accordance with the following rules:
OBV = Previous OBV + Present VolumeOBV = Previous periods OBV - Present VolumeOBV = Yesterday's OBV
volumes - an array of the trading volumes over the last n-periods where the k-th terms of the array if the trading volume on the k-th previous period.
IllegalArgumentException - thrown if either parameter is strictly negative or arrays
volumes is empty.
|
WebCab Technical Analysis v1.1 (J2SE Edition) |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||