[R-SIG-Finance] Quantstrat help
Joshua Ulrich
josh.m.ulrich at gmail.com
Fri Mar 14 21:32:37 CET 2014
On Fri, Mar 14, 2014 at 3:26 PM, NOAH SILVERMAN <noahsilverman at ucla.edu> wrote:
> Josh,
>
> Your comment on the indicator makes sense. I already have it as a column in
> my dataFrame, so I guess that I can just pass that column name when creating
> a signal.
>
> The strategy is a *single asset* with OHLC each minute. I have a few custom
> indicators that are pre-calculated. Just need to test a bunch of signals
> and rules around those indicators and close price. Do I need to do anything
> special to have the dataFrame setup correctly for quantstrat?
>
Yes, you need to convert it to xts. ?applyStrategy says:
mktdata: an xts object containing market data. depending on
indicators, may need to be in OHLCV or BBO formats, default
NULL
The package has several demos, take a look at them to get a feel for
what you need to do.
> Thanks!
>
>
> On Fri, Mar 14, 2014 at 8:52 AM, Joshua Ulrich <josh.m.ulrich at gmail.com>
> wrote:
>>
>> On Fri, Mar 14, 2014 at 10:30 AM, Noah Silverman <noahsilverman at ucla.edu>
>> wrote:
>> >
>> > Hi,
>> >
>> > Working on developing a complex portfolio and backtesting strategy.
>> > >From what I've read, the quantstrat package looks ideal for working
>> > through the ideas.
>> >
>> > Two questions:
>> >
>> > 1) I have an indicator that is pre-calculated. (From a bunch of
>> > complicated functions and outside data.) I'd like to simply pass the
>> > vector of values into quantstrat, but can't figure out how to do that.
>> > The function to add a signal appears to only accept functions, not
>> > data. Is there a way for me to do this?
>> >
>> If it needed a function and there was no way to pass data, you could
>> wrap your data in a function.
>> datafun <- function(...) mydata
>>
>> But nothing *requires* that you call/use add.indicator(). Simply
>> merge your indicator with your market data.
>>
>> > 2) Along the lines of #1 above: I have my financial data directly from
>> > a vendor. It already has OHLC defined. Can I simply pass this to
>> > quanstrat? If so, what is the proper order/formant/naming of columns to
>> > make quanstrat happy?
>> >
>> That depends on the specifics of the strategy you're trying to build,
>> which you haven't provided.
>>
>> > Thanks!
>> >
>> > --
>> > *Noah Silverman, PhD* | UCLA Department of Statistics
>> > 8117 Math Sciences Building, Los Angeles, CA 90095
>> >
>>
>> --
>> Joshua Ulrich | about.me/joshuaulrich
>> FOSS Trading | www.fosstrading.com
>
>
More information about the R-SIG-Finance
mailing list