btutils-package: Utilities to Facilitate Back-Testing of Trading Strategies

Description Details Author(s) References See Also Examples

Description

A collection of utilities to help back testing of trading strategies. Mostly written in C++, thus, speed is not an issue.

Details

Package: btutils
Type: Package
Version: 0.1
Date: 2013-05-07

Best place to start:
simple.trade.indicator
processTrades

Author(s)

Ivan Popivanov

Maintainer: Ivan Popivanov <ivan *dot* popivanov *at* gmail *dot* com>

References

~~ Literature or other references for background information ~~

See Also

~~ Optional links to other man pages, e.g. ~~ ~~ <pkg> ~~

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
require(quantmod)
require(btutils)

# Download some data from Yahoo
spy = getSymbols("SPY", auto.assign=FALSE)

# Compute the indicator for a 200 day moving average
spy.macd = MACD(Cl(spy), nFast=1, nSlow=200)[,1]
spy.indicator = ifelse(spy.macd < 0, 0, 1)

spy.trades = trade.indicator(OHLC(spy), spy.indicator, stop.loss=0.02)
spy.rets = ROC(Cl(spy), n=1, type="discrete")
ec = calculate.returns(spy.rets, spy.trades)

btutils documentation built on May 2, 2019, 6:09 p.m.