Learn R Programming

TTR (version 0.13-1)

TTR-package: Functions to create Technical Trading Rules (TTR)

Description

This package contains many of the most popular technical analysis functions, as well as functions to retrieve U.S. stock symbols, and data from Yahoo Finance.

Arguments

Details

ll{ Package: TTR Type: Package Version: 0.13-1 Date: 2007-10-23 License: GPL Version 2 or later. } Users will probably be most interested in the following functions: bollingerBands changes ADX MovingAverages Oscillators RSI stochastic WebData

References

The following site(s) were used to code/document this package: http://www.fmlabs.com/reference/default.htm http://www.equis.com/Customer/Resources/TAAZ/?p=0 http://www.linnsoft.com/tour/technicalindicators.htm http://stockcharts.com/education/IndicatorAnalysis/

Examples

Run this code
data(ttrc)

  # Bollinger Bands
  bbands <- bollingerBands( ttrc[,c("High","Low","Close")] )

  # Directional Movement Index
  dmi.adx <- ADX(ttrc[,c("High","Low","Close")])

  # Moving Averages
  ema <- EMA(ttrc[,"Close"], n=20)
  sma <- SMA(ttrc[,"Close"], n=20)

  # MACD
  macd <- MACD( ttrc[,"Close"] )

  # RSI
  rsi <- RSI(ttrc[,"Close"])

  # Stochastics
  stoch.osc <- stochastic(ttrc[,c("High","Low","Close")])

  ### Note: you must have a working internet connection
  ### for the examples below to work!

  # Fetch U.S. symbols from the internet
  nyse.symbols <- stockSymbols("NYSE")

  # Fetch Yahoo! Finance data from the internet
  ibm <- getYahooData("IBM", 19990404, 20050607)

Run the code above in your browser using DataLab