atmimomentum {atmi} | R Documentation |
Trading rules are based on the momentum indicator. Using the momentum indicator it should be possible to describe the strength of the price change, as well as to identify the possible imminent trend reversal.
atmimomentum(symbol = FALSE, datamatrix = list(NA, NA), period = c(FALSE, FALSE), n = 10, sma = 10, rule = 1, ticks = 1, plot = TRUE, stopl = FALSE, interest = FALSE, transcost = FALSE, startcap = 1000, standard = TRUE, conf.level = 0.95)
symbol |
a unique series of letters assigned to a security for trading purposes. You can get the symbols by using the function getsymbols or from http://finance.yahoo.com/ . If FALSE, a datamatrix is needed.
|
datamatrix |
a list of two vectors. The first one is a vector of dates, the second one is a vector of prices. |
period |
is a vector of start and end dates, in "YYYY-MM-DD" format. If the start date is FALSE, all available data until the end date will be used. If the end date is FALSE, all available data from the start date will be used. If both are FALSE, all available data will be used. |
n |
length of the period for the calculation of the price difference in the computation of the indicator value. |
sma |
will be used only when rule = 2. This is the Number of observations for the calculation of the simple moving averages (signal line). |
rule |
can be 1 or 2. If equal to 1, then the buy signal occurs, if the Momentum line crosses the zero line from below. The sell signal occurs, if the Momentum line crosses the zero line from above. The rule 2 is the same as 1, except that the buy/sell signals occur by crossing the signal line. |
ticks |
data frequency. For example if ticks=1, every observation will be used in the calculation. If ticks=5, every fifth observation will be used in the calculation. |
plot |
logical; if TRUE, the series with trading signals (buy=green, sell=red) and the indicator will be plotted. |
stopl |
a vector of two arguments for the stop-loss hedging strategy. The first argument can be "s" for static or "d" for dynamic stop-loss hedging. The second argument is the stop-loss limit, it can be between 0 and 1. If stopl=FALSE, no hedging occurs. |
interest |
interest of the non invested capital. It can be a number either greater then zero or FALSE. |
transcost |
transaction costs. It can be a number either greater then zero or FALSE. |
startcap |
initial assets. It can be a number greater than zero. Default 1000 monetary units. |
standard |
logical; If FALSE, the buy and sell signals are successively arranged, where the first trade signal is a signal to buy and the last one is a signal to sell. If TRUE, original trading signals, as they are supplied by the trading rule are returned. |
conf.level |
confidence level for the one-sided confidence interval of number of "hits". "Hits" are signal pairs (a signal to buy and a subsequent signal to sell) which have led to a positive return. The remaining signal pairs are "nonhits". |
To get a trading recommendation for today, the standard
has to be TRUE. Otherwise, in case that after the last Buy signal no Sell signal (based on indicator rule) occurred, the last day will be used as a Sell signal.
signale |
matrix with 2 columns of buy and sell signals (indices of data, where signals are occurred). |
numEqual |
signals occurr on the intersection of two sequences or a sequence and a horizontal line. numEqual is a number of points, where a signal happened and on the day before the first sequence was exactly equal to the second sequence or the horizontal line. |
settings |
settings, which were used for the calculation of the strategy. |
result |
Resuts of the strategy as: |
performance | performance of the strategy for the given period. |
num. signals | number of signal pairs of the strategy for the given period. |
hits | number of "hits" |
leftfront | left front of the confidence interval with the confidence level of conf.level . |
performance BAH | performance of the buy and hold strategy for the given period. |
Waldemar Kemler, Peter Schaffner
[1] Otto. Loistl. (1992) Computergestuetztes Wertpapiermanagement. R. Oldenbourg, Muenchen.
[2] John J. Murphy. (1999) Technical Analysis of the Financial Markets: A Comprehensive Guide to Trading Methods and Applications (New York Institute of Finance), Prentice Hall Press.
atmimacd
, atmirsi
, atminaiv
, performance
#Example 1: Momentum strategy of "AACC" with standard settings (n=10, rule=1). atmimomentum("AACC") #Example 2: Momentum strategy of "AACC" with following settings: n=10, startcapital=1000, interest of non invested capital (2.5 atmimomentum("AACC", standard=FALSE, interest=0.025, transcost=5.9) #Example 3: Momentum strategy of "AACC" for the period from 2004-01-01 through 2005-12-31 with following settings: n=7, rule=2, sma=15 startcapital=1000, interest of invested capital (2.5 atmimomentum("AACC", period=c("2004-01-01","2005-12-31"), n=7, rule=2, sma=15, standard=FALSE, interest=0.025, transcost=5.9, stopl=c("d",0.1))