[R-SIG-Finance] Using quantstrat indicators against columns other than "Close"

Sergey Pisarenko drseergio at gmail.com
Fri Feb 10 17:26:52 CET 2012


I have started using 'quantstrat' to model strategies and cannot
figure out a way to add an indicator that would be calculated against
a column other than "Close". For example, in the code below I create a
5-day SMA:

s         <- add.indicator(strategy=s, name='SMA',
arguments=list(x=quote(Cl(mktdata)), n=5), label='SMA5')

This creates a column with 5-day SMA calculated for the closing price
of the instrument. What is the correct approach of using indicators
against other columns, such as "Volume"?

Appreciate your help.

Kindest Regards,
Sergey Pisarenko.

More information about the R-SIG-Finance mailing list