Plot change of pnl through backtest period
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ## S3 method for class 'modelPortfolio'
plotPnL(this, legs = "all", ...)
plotPnL(this, ...)
## S3 method for class 'modelStrategy'
plotPnL(this, type = "money", comOn = TRUE,
leg = "all", graph_type = "ggplot2", each_year = FALSE,
adjust = FALSE, return_type = "plot", cutoff = FALSE,
start_date = NULL, end_date = NULL, on_percentage = FALSE,
interactive_plot = FALSE, ...)
## S3 method for class 'list'
plotPnL(this, legend = TRUE, interactive_plot = FALSE, ...)
|
this |
modelStrategy |
... |
params |
type |
character, one of c('money','trades','percents') |
comOn |
bool, if true then commission will be included in the 'trades' graph |
leg |
numeric/character, number of leg, if it is equal to 'all' or 'sum', then all pnl among all legs will be summed, if it is equal to 'sep', then pnl among legs will be plotted |
graph_type |
character, ggplot2 or xts |
each_year |
logical, if TRUE, then each graph will start with 0 each year |
adjust |
logical, if TRUE, then values will be divided by getMoney(this) |
return_type |
character, plot or data |
cutoff |
logical, if TRUE then on plot will be horizonal line indicating when model was created |
start_date |
date type, example: start_date='2008-01-01' |
end_date |
date type, example: end_date='2018-01-01' |
on_percentage |
logical, if TRUE then on plot will be in percentage |
interactive_plot |
logical, if it is TRUE and graph_type == 'ggplot2', plot will be interactive |
legend |
logical, if true then legend will be printed on the plot |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.