Brian,

Thanks for your detailled answer.
Regarding the code, I do not have an example (yet). This was more a high
level question before jumping into coding.
Regarding my 'pencil' name, I am Samuel Florian, nice to write you ;-)

You correctly guessed the loopback period is a parameter and I will look
into 'applyParameter()'. My goal here is not to test different parameter(s)
values  to find the best one (set), but to actually run (live trading) the
same strategy with several set of parameters. For instance, I would run a
SMA 50 days and a SMA 200 days along with a Bollinger bands 20 days and a
Bollinger bands 50 days, each one being allocated 25% of risk budget.
However, this set of four strategies will generate daily trades that may
partially or fully net each other before execution (input being daily OHLC,
but execution will look at tickdata).

I am then interested in knowing the performance of what I called the
'aggregated level' which is I guess the account.
I will give it a shot. Thanks for your help.
Sam







On Wed, Jan 18, 2012 at 6:58 PM, Brian G. Peterson <brian@braverock.com>wrote:

> On Wed, 2012-01-18 at 17:21 +0100, Faber Castell wrote:
> > Hello,
> >
> > I am trying to determine what is the proper way to organize my work :
> >
> > I have several model (moving average, bollinger bands...) that I run
> using
> > sevral set of lookback periods.
> >
> > Within quantstrat, should I have:
> > - a strategy per unique combination of (model, lookback period) ?
> > - a strategy per unique combination of model, so a strategy would be a
> > model applied to a set of lookback period ?
> > - something else ?
> >
> > Or am I mixing strategies and portfolios ? As I can read that
> > "applyStrategy()" will run one strategies in one or many portfolios.
> >
> > Would it be possible for one of you to clarify what is the role of
> > portfolios versus strategies and their link to models and look back
> period?
> >
> > In the end, my goal is to backtest my set of model x lookback period to
> see
> > what is the result at an aggregated level.
>
> A strategy in quantstrat is *only* a 'model'.
>
> It is the unique combination of indicators, signals, and rules.
>
> There is no explicit concept for 'look back period', and you didn't
> follow the posting guide to provide reproducible code, so I'm just
> guessing.  I would guess, given the limited context, that lookback
> period is a *parameter*.  See both the simple parameters= named list
> argument to applyStrategy and the more complicated and more powerful
> applyParameters and related functions.
>
> Now, how does all this relate to portfolios?
>
> Answer: That depends on how you want to use it.
>
> the blotter package, which is used by quantstrat for all the transaction
> accounting, was made intentionally flexible in the organization, only
> requiring that portfolios aggregate to an account, and that the same
> account may only contain one copy of a given portfolio (but different
> accounts may contain the same portfolio, allowing you to do different
> slicing and dicing, if you're careful).  quantstrat doesn't care about
> any of this, just needing to know which portfolio to place trades into
> for a specific instrument.
>
> Most (all?) of the quantstrat demo scripts that trade more than one
> instrument create one single portfolio that contains all the instruments
> in the demo, which makes it a little easier to aggregate performance for
> the entire 'portfolio' of instruments.  This type of aggregation would
> also be required if you, for example, used some of the functions Guy
> Yollin talked about in his UW quantstrat lectures[1] to do things like
> capital-aware trade sizing.
>
> applyParameters will create a separate portfolio for each unique
> combination of strategy and parameter sets (with one or more instruments
> tested per portfolio), which may create hundreds or thousands of
> portfolios, depending on how many combinations you test.  This is useful
> for evaluating the 'parameter robustness' of your strategy, and keeping
> the results of different parameter combinations.
>
> When I am comparing a mature strategy to the production trading logs I
> use one portfolio per instrument (or group of instruments traded
> together, as with an automated spreader).  This lets me use
> reconciliation features built into the blotter package to evaluate the
> differences between the model and the reality of our production trades.
>
> That said, these are only three examples.  How you choose to subset your
> instruments and parameters into portfolios and accounts may vary based
> on how you want to use the resulting data.
>
> Hopefully, this clears things up a little.
>
> ..and next time, please do everyone the courtesy of using your name[2].
> I don't much like answering questions from pencils.  You get a hall pass
> this time because it was a reasonable and intelligent question.[2] ;)
>
> Regards,
>
>   - Brian
>
> Ref:
> [1] http://www.r-programming.org/papers
> [2] http://catb.org/~esr/faqs/smart-questions.html
>
>
> --
> Brian G. Peterson
> http://braverock.com/brian/
> Ph: 773-459-4973
> IM: bgpbraverock
>
> _______________________________________________
> R-SIG-Finance@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions
> should go.
>

	[[alternative HTML version deleted]]

