|
WebCab Technical Analysis (J2EE Edition) |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Moving Averages in there various forms are used to smooth data so that the underlying trend is more discernible. Since a moving average's aim is to recognize a trending market from historical prices the sensitivity of the measures will depend on the number of a historical values used. For relatively few values used the moving average may itself oscillate rapidly and give many force signals to the start of trending markets. If many values are used fewer force signals will be generated but a trend may in well into its cycle before it is detected and conversely when the trend finishes or changes direction the indicator will take correspondingly longer the reflect this.
With the construction of the moving averages themselves the main significant difference between them is the weight assigned to each price point. Simple moving averages apply equal weight to all historical prices. Exponential and weighted averages apply more weight to recent prices. Triangular averages apply more weight to prices in the middle of the time period and variable moving averages change the weighting based on the volatility of prices.
Interpretation
When the moving average us higher than the asset price then the asset is in a bearish
trend (i.e. trending down) and when the asset is above the moving average then the asset
is in a bullish trend (i.e. trending up-wards).
Moving Averages are also used in pairs and even triples. When using a pair of moving averages of the same type where one moving average uses fewer days and hence is more sensitive, the underlying asset is said to be in bullish mode if the moving average using the fewer number of days crosses above the less sensitive moving average which is using more days data. Conversely, if the less sensitive moving average cross above the more sensitive moving average then asset is said to be in a bearish mode.
All moving averages are lagging indicators and hence will miss the first part of a trend and over-run the same trend. There is also a play-off is the number of historical days use which determines the sensitivity of the indicator.
| Method Summary | |
double |
exponentiallyWeightedMovingAverage(double[] timeSeries,
double smoothingFactor)
Evaluates the (x-day) Exponentially Weighted Moving Average (EWMA) of a time series from the 0-th period until the (x-1)-th period. |
double |
geometricMovingAverage(double[] historicalValue)
Calculates the x-day Geometric Moving Average (GMA) which is the geometric average of the values given over the past x days. |
double |
kairi(double movingAverage,
double price)
Calculates the Kairi Indicator measures as a percentage of the price the divergence between the a moving average (generally the simple moving average) of the price and the price itself. |
double |
linearlyWeightedMovingAverage(double[] priceSeries)
Returns the value of the Linearly Weighted Moving Average (LWMA) of a (finite) price series. |
double |
medianMovingAverage(double[] historicalHigh,
double[] historicalLow)
Returns the x-day Median Moving Average of the market price of a traded asset over the past x-days. |
int |
simpleCrossingSignal(double lastShortMA,
double previousShortMA,
double lastLongMA,
double previousLongMA)
Generates of trading signal in accordance with the Simple crossing two moving average trading system. |
double |
simpleMovingAverage(double[] historicalPrice)
Calculates the x-day arithmetic moving average of the market price of a traded asset over the past x-days. |
double |
weightedxDayMovingAverage(double[] historicalPrices,
double[] weights)
Here we evaluate the Weighted Moving Average (WMA) which allows you to assign more significance to resent price dynamics. |
| Methods inherited from interface javax.ejb.EJBObject |
getEJBHome, getHandle, getPrimaryKey, isIdentical, remove |
| Method Detail |
public double simpleMovingAverage(double[] historicalPrice)
throws RemoteException
historicalPrice - an array of length x, where the first element historicalPrice[0], corresponds to the market price on the first of the x-day period. The term historicalPrice[1], corresponds to the market price of the second of the x-day period, and so on...
IllegalArgumentException - thrown if the historicalPrices array is empty.
RemoteException
public double medianMovingAverage(double[] historicalHigh,
double[] historicalLow)
throws RemoteException
historicalHigh - an array where the first element historicalHigh[0], corresponds to the highest market price during the last trading period, the historicalHigh[1], corresponds to the highest market price in the previous period, and so on..historicalLow - an array where the first element historicalLow[0], corresponds to the lowest market price during the last trading period, the historicalLow[1], corresponds to the lowest market price in the previous period, and so on...
IllegalArgumentException - thrown if the arrays historicalHigh and historicalLow
are of different lengths or if one of these arrays is empty.
RemoteException
public double geometricMovingAverage(double[] historicalValue)
throws RemoteException
historicalValue - an array of length x, where the first element historicalPrice[0], corresponds to the market on the first of the x-day period. The term historicalPrice[1], corresponds to the market price of the second of the x-day period, and so on...
IllegalArgumentException - thrown if the historicalValue array is empty.
RemoteException
public double weightedxDayMovingAverage(double[] historicalPrices,
double[] weights)
throws RemoteException
weights - this is an array of length x, which assigns to each of the historicalPrices a weighting. The ith element weights[i], assigns to the element historicalPrice[i], a weighting.historicalPrices - an array of length x, where the first element historicalPrice[0], corresponds to the market on the first of the x-day period. The term historicalPrice[1], corresponds to the market price of the second of the x-day period, and so on.
IllegalArgumentException - thrown if the length of the weights and historicalPrices
arrays differ or if either array is empty.
RemoteExceptionxDayMovingAverage
public double linearlyWeightedMovingAverage(double[] priceSeries)
throws RemoteException
priceSeries - an array where the first element is the price on the earliest day, the second element is the price on the next earliest day and on so.
IllegalArgumentException - thrown if the array priceSeries is empty.
RemoteException
public double exponentiallyWeightedMovingAverage(double[] timeSeries,
double smoothingFactor)
throws RemoteException
timeSeries - an array where the first value corresponds to the value of the asset in the $t$th period, and the second value corresponds to the value of the asset in the $t-1$th period and so onsmoothingFactor - the number between 0 and 1 which is known as a smoothing factor. The closer the value is to zero the more influence more resent measurements will have on the EWMA.
IllegalArgumentException - thrown if the timeSeries is empty or if the value
given for the smoothing factor lies outside the closed range [0,1].
RemoteException
public double kairi(double movingAverage,
double price)
throws RemoteException
The formulae for the Kairi Indicator is as follows:
where MA is the moving average being considered and price is the present price of the underlying asset.
Application
The Kairi Indicator can be used in order to take advantage of an over extended trending market. For example, in an upwardly trending market when the price gets say more than 10% above the simple moving average, the asset could be sold and repurchased when the next hits the simple moving average again.
The Kairi Indicator could also be used in order to detect market tops and bottom. The idea being that market tops and bottoms often occur when the price is at an extreme value in relation to its moving average. That is, the Kairi Indicator should take an extreme value at market tops and bottoms.
movingAverage - the value of the moving average (generally the simple moving average) of the underlying assetprice - the present price of the underlying asset
RemoteException
public int simpleCrossingSignal(double lastShortMA,
double previousShortMA,
double lastLongMA,
double previousLongMA)
throws RemoteException
Selecting the Moving Averages
You will need to select the type of moving average used and the different periods over which these moving averages are evaluated. In most, instances the simple moving average is used but in principle any type of moving average could be used. The periods of moving averages must be different. Typical choices of period used correspond roughly to convenient time periods, such as: 5 (1 week), 20 (1 month), 50 (2 months) (i.e. 50), 200 (1 year).
We will refer to the moving average with the shorter period as the Short MA, and the moving average with the longer period as the Long MA. Corresponding to the fact that they measure the trending behavior on shorter and long time spans.
Generation of Trading Signals
Trading signals are generated when:
lastShortMA - the last value of the Short moving average (i.e. the moving average with the shorter period)previousShortMA - the previous value of the short moving average (i.e. the moving average with the shorter period)lastLongMA - the last value of the Long moving average (i.e. the moving average with the longer period)previousLongMA - the previous value of the long moving average (i.e. the moving average with the long period)
RemoteException
|
WebCab Technical Analysis (J2EE Edition) |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||