Dear Brian,
I tried the custom indicator, 'indiMerge', and it seems that I was mistaken 
From the codes:
indMerge &lt;- function(mktdata=quote(mktdata),x){
 if (!is.xts(x)) x &lt;- getSymbols(x, auto.assign = FALSE)
 x &lt;- cbind(mktdata, x[paste(first(index(mktdata)) , last(index(mktdata)) , sep='/')])
 x &lt;- na.locf(x)
 x
}
the output 'x' of indMerge will be mktdata with merged-in reference data.
 
So, I tried add.indicator codes like below and got error messages :
stratTest &lt;- add.indicator(strategy = stratTest, name = "indMerge", 
 arguments = list(mktdata=quote(mktdata),x=dailyindex) ) 
Error in if (inherits(sret$indicators, "xts") & nrow(mktdata) == nrow(sret$indicators)) { : 
 argument is of length zero
stratTest &lt;- add.indicator(strategy = stratTest, name = "indMerge", 
 arguments = list(x=dailyindex)
Error in merge.xts(..., all = all, fill = fill, suffixes = suffixes) : 
 object is not a matrix
Obviously, the dailyindex is a matrix.
 
I am not sure how to use 'indMerge' function and call the output 'x' which has merged-in data.
Can you show me an example?
Thanks for your help.
Wonjae
-----Original Message-----
From: "Brian G. Peterson"&lt;brian@braverock.com&gt; 
To: "이원재"&lt;wjlee2002@naver.com&gt;
Cc: r-sig-finance@r-project.org
Sent: 11-08-27(토) 23:37:17
Subject: Re: [R-SIG-Finance] [R] Quantstrat package question
On Sat, 2011-08-27 at 22:20 +0900, 이원재 wrote:
> Hi, 
> I am working on Quantstrat package. 
> I would like to ask if it is possible to use reference data in the qunatstrat packages.
Of course you can.
> For example, my market data for trading is 'intra-day' data, and I need to use daily indicators which are computed with 'daily' index data like S&P 500.
You'll need to have your indicator function look up and merge for you.
> But, in this packages, every data has to be a trading symbol in order to be called by functions such as 'add.indicator' and 'add.signal'.
The trading data is all symbols that you will trade, correct, but your
indicator and signal functions can take any arguments.
> Is is possible to use indicators from reference data, especially in a different time frame with trading symbols?
I think you're going to want to write a quick custom indicator,
something like:
indMerge &lt;- function(mktdata=quote(mktdata),x){
 if (!is.xts(x)) x &lt;- getSymbols(x, auto.assign = FALSE)
 x &lt;- cbind(mktdata, x[paste(first(index(mktdata)) , 
 last(index(mktdata)) , sep='/')])
 x &lt;- na.locf(x)
 x
}
This works for me to merge in the columns of SPY from yahoo to a tick
data series.
I often do similar things for strategy parameters that can change daily,
I just merge them and na.locf so that they'll be availabe at every
timestamp internally. Not the most memory-efficient, but simplifies
many other things so that I don't have to write some many custom
functions later in the stack.
 
Regards,
 - Brian
-- 
Brian G. Peterson
http://braverock.com/brian/
Ph: 773-459-4973
IM: bgpbraverock

	[[alternative HTML version deleted]]

