TechnicalAnalysis {fTrading}R Documentation

Tools for the Technical Analysis

Description

A collection and description of functions for the technical analysis of stock markets. The collection provides a set of the most common technical indicators.

Utility Functions:

emaTA Exponential Moving Average,
biasTA Bias Indicator,
medpriceTA Medium Price Indicator,
typicalpriceTA Typical Price Indicator,
wcloseTA Weighted Close Indicator,
rocTA Rate of Change,
oscTA Oscillator Indicator.

Oscillator Indicators:

momTA Momentum Indicator,
macdTA MACD Indicator,
cdsTA MACD Signal Line,
cdoTA MACD Oscillator,
vohlTA High/Low Volatility,
vorTA Volatility Ratio.
stochasticTA Stochastics Oscillator,
fpkTA Fast Percent K,
fpdTA Fast Percent D,
spdTA Slow Percent D,
apdTA Averaged Percent D,
wprTA William's Percent R,
rsiTA Relative Strength Index.

S-Plus Like Moving Averages:

SMA Simple Moving Average,
EWMA Exponentially Weighted Moving Average.

Usage

emaTA(x, lambda, startup = 0)
biasTA(x, lag)
medpriceTA(high, low)
typicalpriceTA(high, low, close)
wcloseTA(high, low, close)
rocTA(x, lag)
oscTA(x, lag1 = 25, lag2 = 65)

momTA(x, lag)
macdTA(x, lag1, lag2)
cdsTA(x, lag1 = 12, lag2 = 26, lag3 = 9)
cdoTA(x, lag1 = 12, lag2 = 26, lag3 = 9)
vohlTA(high, low)
vorTA(high, low)

stochasticTA(close, high, low, lag1 = 5, lag2 = 3, lag3 = 5, 
    type = c("fast", "slow")) 
fpkTA(close, high, low, lag)
fpdTA(close, high, low, lag1, lag2)
spdTA(close, high, low, lag1, lag2, lag3)
apdTA(close, high, low, lag1, lag2, lag3, lag4)
wprTA(close, high, low, lag)
rsiTA(close, lag)

SMA(x, n = 5)
EWMA(x, lambda, startup = 0)

Arguments

lag, lag1, lag2, lag3, lag4

integer values, time lags.

n

[SMA] -
an integer value, time lag.

lambda

[emaTA][EWMA] -
a numeric value between zero and one giving the decay length of the exponential moving average. If an integer value greater than one is given, lambda is used as a lag of "n" periods to calculate the decay parameter.

startup

[emaTA][EWMA] -
an integer value, the startup position of the exponential moving average, by default 0.

type

[stochasticTA] -
a character string, either "fast" or ""slow" characterizing the type of the percent K and percent D indicator. By default type="fast"

x, high, low, close

a numeric vector of prices, either opening, closing, or high and low values. For ohlcPlot a multivariate time series object of class mts.

Value

*TA
The technical Indicators return the following numeric vectors (or matrix):

emaTA returns the Exponential Moving Average, EMA
biasTA returns the EMA-Bias,
medpriceTA returns the Medium Price,
typicalpriceTA returns the Typical Price,
wcloseTA returns the Weighted Closing Price,
rocTA returns the Rate of Change Indicator,
oscTA returns the EMA Oscillator Indicator,
momTA returns the Momentum Oscillator,

macdTA returns the MACD Oscillator,
cdsTA returns the MACD Signal Line,
cdo returns the MACD Oscillator,
vohlTA returns the High/Low Volatility Oscillator,
vorTA returns Volatility Ratio Oscillator,

stochasticTA returns a 2-column matrix with percent K and D Indicator,
fpkTA returns the Fast Percent-K Stochastics Indicator,
fpdTA returns the Fast Percent-D Stochastics Indicator,
spdTA returns the Slow Percent-D Stochastics Indicator,
apdTA returns the Averaged Percent-D Stochastics Indicator,
wprTA returns the Williams Percent-R Stochastics Indicator,
rsiTA returns the Relative Strength Index Stochastics Indicator.

Author(s)

Diethelm Wuertz for the Rmetrics R-port.

Examples

## data -
   # Load MSFT Data:
   x = MSFT
   colnames(x)
   x = x[, "Close"]
   head(x)
   
## emaTA -
   # Exponential Moving Average:
   y = emaTA(x, lambda = 9)   
   seriesPlot(x)
   lines(y, col = "red")

[Package fTrading version 3042.79 Index]