[R-SIG-Finance] log-return indicator
Brian G. Peterson
brian at braverock.com
Thu Feb 21 13:23:03 CET 2013
On 02/21/2013 05:44 AM, Dominykas Grigonis wrote:
> Dear everyone,
>
> past 24 hours I have been testing some intraday strategies with
> blotter. Is there an indicator in any package that calculates
> log-returns? It is obviously simple to diff(log(x)), but I would like
> to see the return series in final chart: chart.Posn(portname,
> Symbol=ticker, Dates='2010::') to be able to analyse and spot flaws.
>
> Any ideas?
Transactions are, of course, made in prices, not returns. blotter
doesn't know anything about returns or *how* you generate the
transactions that you tell it about.
There are many pre-built functions to take a price series and generate
log returns.
?Return.calculate
?ROC
?allReturns
will all work.
chart.Posn uses the newer chart_Series functions from quantmod. So you
can easily call add_TA with any of the above or with diff(log(x)) to add
another panel of log returns to the output of chart.Posn.
Regards,
- Brian
--
Brian G. Peterson
http://braverock.com/brian/
Ph: 773-459-4973
IM: bgpbraverock
More information about the R-SIG-Finance
mailing list