My problem is, however, kinda different. E.g. in my example above, I need 
to modify (as simply as possible) length of both moving averages, 
externally, best through 'parameters' argument:

 applyStrategy(strategy=stratMACROSS , portfolios=portfolio.st, 
parameters=list(n=50, n=200)) 

The problem is, I can't set n=50 for first MA and n=200 for second MA, 
because both MA indicators use same name argument 'n'. 
Thus, setting parameters=list(n=50, n=200) causes the system to use only 
first 'n=50' ignoring second 'n=200'. 
Is there any simple way how to set parameters like 'n1=50, n2=200'? I.e. 
to differentiate between these two with same names?

Thanks,

with regards,

Igor







On Tue, 2011-09-06 at 15:40 +0200, igor_vilcek_external@tatrabanka.sk
wrote:
> Hi, 
> 
> I've encountered a problem in external parameters setting, in case I 
want 
> to set parameters for more indicators which posses same argument names 
> (e.g. setting length of multiple different Moving Averages - same name 
> parameter 'n').
> 
> I can demonstrate this issue using quantstrat demo maCross (strategy 
uses 
> "short" and "long" moving average, and my aim is to set length of both 
> averages through 'parameters' argument in applyStrategy):
<...>

> Using this input, strategy uses only "50day" Moving Average, for both 
MA50 
> and MA200 in 'mktdata'.
> 
> Is there any way how to implement length of both different moving 
averages 
> (or other indicators e.g. ROC, BBands,... with same arguments) into 
> 'parameters'?

You have two options, a simple one, and a more complex one.

The simple one is for you to generate a brute force set of parameters
and loop over them, setting them as variables in  your strategy using
quote().  see ?expand.grid

Or, more flexible but also more complicated, see the two parameterTest
demos in the quantstrat package.  You can tell the parameter subsystem
which slots (indicators) you are applying parameters to, and apply a
different distribution to each.

Regards,

  - Brian

-- 
Brian G. Peterson
http://braverock.com/brian/
Ph: 773-459-4973
IM: bgpbraverock






____________________________________________________________________
Informacie obsiahnute v tomto  dokumente su urcene vylucne pre
potreby jeho adresata. Dokument moze obsahovat informacie chranene
ako bankove alebo obchodne tajomstvo, pripadne informacie
podliehajuce ochrane podla inych pravnych predpisov. Preto Vas v
pripade, ak Vam bol  mylne doruceny, vyzyvame, aby ste sa zdrzali
jeho odtajnenia ci jeho pouzitia pre vlastne potreby. Zaroven si Vas
dovolujeme poziadat, aby ste nas o takomto pripade bez zbytocneho
odkladu informovali a dokument nasledne zlikvidovali.

Information stated in this document is intended only for needs of proper
addressees of this document. This document can contain information
protected as a bank or business secret, or information protected by 
other legal regulations. Thus in case of receiving the document by error,  
we kindly ask you not to disclose, or use the document for your own 
needs. Likewise we kindly ask you to notify us immediately upon such 
a case by sending an email message to the sender's address, and 
subsequently delete the document.

Tatra banka, a.s.
http://www.tatrabanka.sk
Hodzovo namestie 3,  811 06 Bratislava 1 
ICO: 00 686 930
Zapisana v obchodnom registri Okresneho sudu Bratislava I
Oddiel: Sa, vlozka cislo: 71/B
	[[alternative HTML version deleted]]

