tradeModel             package:quantmod             R Documentation

_S_i_m_u_l_a_t_e _T_r_a_d_i_n_g _o_f _F_i_t_t_e_d _q_u_a_n_t_m_o_d _O_b_j_e_c_t

_D_e_s_c_r_i_p_t_i_o_n:

     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 and return a 'tradeLog' object.  Additional methods can
     then  be called to evaluate the performance of the model's
     strategy.

_U_s_a_g_e:

     tradeModel(x,
                signal.threshold = c(0, 0),
                leverage = 1,
                return.model = TRUE, 
                plot.model = FALSE,
                trade.dates = NULL,
                exclude.training = TRUE,
                ret.type = c("weeks", "months", "quarters", "years"),
                ...)

_A_r_g_u_m_e_n_t_s:

       x: a quantmod object from 'buildModel'  

signal.threshold: a numeric vector describing simple lower and upper
          thresholds before trade occurs

leverage: amount of leverage to apply - currently a constant 

return.model: should the full model be returned? 

plot.model: plot the model? 

trade.dates: specific trade interval - defaults to full dataset 

exclude.training: exclude the period trained on? 

ret.type: a table of period returns 

     ...: additional parameters needed by the underlying modelling
          function, if any 

_D_e_t_a_i_l_s:

     Still highly experimental and changing. The purpose is to apply a
     newly contructed 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.

     Any suggestions as to inclusions or alterations are appreciated
     and should be directed to the maintainer of the package.

_V_a_l_u_e:

     A quantmodResults object

_A_u_t_h_o_r(_s):

     Jeffrey A. Ryan

_S_e_e _A_l_s_o:

     'specifyModel' 'buildModel'

_E_x_a_m_p_l_e_s:

     ## Not run: 
     m <- specifyModel(Next(OpCl(QQQQ)) ~ Lag(OpHi(QQQQ)))
     m.built <- buildModel(m,method='rpart',training.per=c('2007-01-01','2007-04-01'))

     tradeModel(m.built)
     tradeModel(m.built,leverage=2)
     ## End(Not run)

