WebCab Technical Analysis
v1.1
(J2SE Edition)

webcab.lib.finance.trading.indicators
Class MarketStrength

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

public class MarketStrength
extends Object
implements Serializable

A number of indicators including Balance of Power, Market Facilitation Index which measure the relative strength or weakness of the market.

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 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:

  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
MarketStrength()
          Creates a new instance.
 
Method Summary
 double balanceOfPower(double open, double close, double high, double low)
          Implements the Balance of Power (BOP) indicator, created by Igor Livshin; which captures the struggle between the Bulls and Bears throughout a trading period.
 double[] balanceOfPowerOverPeriod(double[] open, double[] close, double[] high, double[] low)
          Evaluates the Balance of Power (BOP) indicator, created by Igor Livshin; which captures the struggle between the Bulls and Bears over a number of trading periods.
 double marketFacilitationIndex(double high, double low, double volume)
          Market Facilitation Index was developed by Dr. Bill Williams and take into consideration the price and volume.
 double[] marketFacilitationIndexOverPeriod(double[] high, double[] low, double[] volume)
          Market Facilitation Index was developed by Dr. Bill Williams and take into consideration the price and volume.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MarketStrength

public MarketStrength()
Creates a new instance.

Method Detail

balanceOfPower

public double balanceOfPower(double open,
                             double close,
                             double high,
                             double low)
Implements the Balance of Power (BOP) indicator, created by Igor Livshin; which captures the struggle between the Bulls and Bears throughout a trading period.

Interpretation

The BOP indicator for each trading period lies within the range [-1,1]. When the BOP indicator is towards the high if its range it will signifies that the Bulls are in control, conversely when the indicator is towards the lows of its range it signifies that the bear are in control. If the indicator move from a high positive range to a lower positive range it signifies that the buying pressure is decreasing. Conversely, if the indicator move from a low negative range to a higher negative range it signifies that the selling pressure is decreasing.

Evaluation

The BOP indicator is evaluated by the following formulae:

BOP = (Close - Open)/(High - Low),

where Close is the periods closing price, Open is the periods opening price, High is the highest traded price during the period and Low is the lowest traded price during the period.

Parameters:
open - the opening price of the asset on the trading period under consideration
close - the closing price of the asset on the trading period under consideration
high - the traded high of the asset on the trading period under consideration
low - the traded low of the asset on the trading period under consideration
Returns:
The double value of the Balance of Power indicator for the trading period under consideration.
See Also:
balanceOfPowerOverPeriod - a generalization of this indicator which calculates the values of the Balance Of Power indicator over specified period.

balanceOfPowerOverPeriod

public double[] balanceOfPowerOverPeriod(double[] open,
                                         double[] close,
                                         double[] high,
                                         double[] low)
Evaluates the Balance of Power (BOP) indicator, created by Igor Livshin; which captures the struggle between the Bulls and Bears over a number of trading periods. An array is returned where the first term corresponds to the BOP of the last trading period, the second term gives the BOP on the previous trading period and so on.

Interpretation

The BOP indicator for each trading period lies within the range [-1,1]. When the BOP indicator is towards the high if its range it will signifies that the Bulls are in control, conversely when the indicator is towards the lows of its range it signifies that the bear are in control. If the indicator move from a high positive range to a lower positive range it signifies that the buying pressure is decreasing. Conversely, if the indicator move from a low negative range to a higher negative range it signifies that the selling pressure is decreasing.

Evaluation

The BOP indicator for each trading periods is evaluated by the following formulae:

BOP = (Close - Open)/(High - Low),

where Close is the periods closing price, Open is the periods opening price, High is the highest traded price during the period and Low is the lowest traded price during the period.

Parameters:
high - an array of length equal to the number of periods considered in the indicator evaluation where the first element is the high in the last trading period, the second term is the high in the previous period and so on.
low - an array of length equal to the number of periods considered in the indicator evaluation where the first element is the low in the last trading period, the second term is the low in the previous period and so on.
open - an array of length equal to the number of periods considered in the indicator evaluation where the first element is the opening price in the last trading period, the second term is the opening price in the previous trading period and so on.
close - an array of length equal to the number of periods considered in the indicator evaluation where the first element is the closing price in the last trading period, the second term is the closing price in the previous trading period and so on.
Returns:
An array is returned where the first term corresponds to the BOP of the last trading period, the second term gives the BOP on the previous trading period and so on.
Throws:
IllegalArgumentException - thrown if any elements from the arrays high, low, close or open are strictly negative, or if the length of these arrays are not equal.
See Also:
balanceOfPower - evaluates the Balance of Power (BOP) indicator for a single trading period.

marketFacilitationIndex

public double marketFacilitationIndex(double high,
                                      double low,
                                      double volume)
Market Facilitation Index was developed by Dr. Bill Williams and take into consideration the price and volume.

Evaluation

The formula for the calculation of MFI is:

MFI = (high - low)/volume,

where high is the highest traded price during the period, low is the lowest traded price during the period and, volume is the overall volume traded on that period.

Interpretation

There are four types of trading sessions called:

  1. Fakes - volume is low but MFI is rising
  2. Fades - both volume and MFI is down (the price might move in the opposite direction)
  3. Squats - the volume is up, MFI is down
  4. Greens - when the MFI and volume are up which represent a strong signal to follow the trend line

Parameters:
high - the traded high of the asset on the trading period under consideration
low - the traded low of the asset on the trading period under consideration
volume - the traded volume of the asset on the trading period under consideration
Returns:
The double value of the Market Facilitation Index for the trading period under consideration.
See Also:
marketFacilitationIndexOverPeriod - a generalization of this indicator which calculates the values of the Market Facilitation Index indicator over specified period.

marketFacilitationIndexOverPeriod

public double[] marketFacilitationIndexOverPeriod(double[] high,
                                                  double[] low,
                                                  double[] volume)
Market Facilitation Index was developed by Dr. Bill Williams and take into consideration the price and volume.

Evaluation

The formula for the calculation of MFI is:

MFI = (high - low)/volume,

where high is the highest traded price during the period, low is the lowest traded price during the period and, volume is the overall volume traded on that period.

Interpretation

There are four types of trading sessions called:

  1. Fakes - volume is low but MFI is rising
  2. Fades - both volume and MFI is down (the price might move in the opposite direction)
  3. Squats - the volume is up, MFI is down
  4. Greens - when the MFI and volume are up which represent a strong signal to follow the trend line

Parameters:
high - an array of length equal to the number of periods considered in the indicator evaluation where the first element is the high in the last trading period, the second term is the high in the previous period and so on.
low - an array of length equal to the number of periods considered in the indicator evaluation where the first element is the low in the last trading period, the second term is the low in the previous period and so on.
volume - an array of length equal to the number of periods considered in the indicator evaluation where the first element is the volume in the last trading period, the second term is the volume in the previous trading period and so on.
Returns:
An array is returned where the first term corresponds to the MFI of the last trading period, the second term gives the MFI on the previous trading period and so on.
Throws:
IllegalArgumentException - thrown if any elements from the arrays high, low, volume are strictly negative, or if the length of these arrays are not equal.
See Also:
marketFacilitationIndex - evaluates the Market Facilitation Index (MFI) indicator for a single trading period.

WebCab Technical Analysis
v1.1
(J2SE Edition)