SimpleMovingAverage: SimpleMovingAverage

Description Usage Arguments Value Examples

View source: R/SimpleMovingAverage.R

Description

SimpleMovingAverage

Usage

1
2
SimpleMovingAverage(x, k = 200, nd = 365.25, rf = 1, alpha = 0.05,
  Initpocket = NULL, TransCost = NULL)

Arguments

x

xts object in the form of OHLC or only closing prices

k

# of days to take SimpleMovingAverage over (init 200)

nd

# of trading days (init 365.25 since this is made for crypto. Else use 250)

rf

Risk free rate used calculating the Sharperatio. (init 1)

alpha

quantile used calculating the VaR and ES

Initpocket

Initial pocket to implement the strategy

TransCost

Transaction cost, here it is assumed the same for buy and sell

Value

List with xts objects of cum. returns, weights and table of values of performance. If Initpocket and TransCost is not null,xts object of these will be returned. Warnings will come if there isn't enough money to implement the strategy.

Examples

1
2
BTC <- getSymbols("BTC-USD", auto.assign = FALSE)
SimpleMovingAverage(BTC)

3schwartz/cryptoPlay documentation built on May 18, 2019, 2:33 a.m.