tradeModel: Simulate Trading of Fitted quantmod Object

Description Usage Arguments Details Value Examples

Description

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
NOT IMPLEMENTED YET

Perform Realization from using the R CRAN package quantmod functions
of modeling. This is real world actual testing (of Prediction).
This is a re-implementation of the R CRAN package
quantmod function tradModel.  It uses the R CRAN package
PerformanceAnalytics function Return.portfolio to do the heavy work.
Several PerformanceAnalytics exported functions replace out
some or part of quantmod non-exported functions
tradeModel, modelReturn, allReturns, periodReturn, and stripModelData.

This function subtracts off many features from the R CRAN package
quantmod function tradeModel.

Simulated trading of fitted quantmod object.
Given a fitted model, tradeModel calculates the signal generated
over a given historical period, then applies specified
trade.rule to calculate a return.

Usage

1
2
3
4
5
6
7
tradeModel(
  x,
  signal.threshold = c(0, 0),
  trade.dates = NULL,
  exclude.training = TRUE,
  ...
)

Arguments

x

quantmod object (from buildModel). Required.

signal.threshold

Numeric vector. Default is c(0, 0). A numeric vector describing simple lower and upper thresholds before trade occurs.

trade.dates

Default is NULL. Specific trade interval - defaults to the full dataset. This can be a vector of pairs. This can be a list of vectors of pairs.

exclude.training

Logical. Default is TRUE. Exclude the period trained on?

...

Dots pass to additional parameters needed by the underlying modeling function, if any.

Details

1
2
3
4
5
6
7
8
9
Apply a newly constructed model from buildModel to a new dataset
to investigate the model's trading potential.

At present all parameters are very basic. The near term changes
include allowing for a trade.rule argument to allow for a
dynamic trade rule given a set of signals.

Additional the application of variable leverage and costs
will become part of the final structure.

Value

A quantmodResults object. The realizations.

Examples

1
2
3
4
## Not run: 
tradeModel(specmodel)@returns

## End(Not run)

AndreMikulec/econModel documentation built on June 30, 2021, 9:48 a.m.