Dear all,

Using the quantstrat package, I run into the following issue : I am trying
to add a simple 60 days standard deviation indicator to my strategy, I am
not getting the expected result.

The below example charts both what I expect and what I get :

require(quantstrat)
require(PerformanceAnalytics)

# inz currency and stocks
currency('USD')
stock.str = c("INTC")
for(symbol in stock.str) stock(symbol, currency="USD",multiplier=1)
# download stocks
start.data <- as.Date("2010-06-02")
end.data <- as.Date("2010-12-09")
initDate <- start.data-1
for(symbol in stock.str)
getSymbols(symbol,from=start.data,to=end.data,adjust=T)

strat.name <- "RSI"
initEq=1000000

initPortf(name=strat.name,symbols=stock.str, initDate=initDate)
initAcct(name=strat.name,portfolios=strat.name,initDate=initDate,
initEq=initEq)
initOrders(portfolio=strat.name,initDate=initDate)
strat <- strategy(strat.name)

# indicators:
strat <- add.indicator(strategy = strat, name = "RSI", arguments =
list(price = quote(getPrice(mktdata))), label="RSI")
strat <- add.indicator(strategy = strat, name = "runSD", arguments = list(x
= quote(getPrice(mktdata)), n=60, sample=TRUE, cumulative=FALSE),
label="SD60")

out<-try(applyStrategy(strategy=strat, portfolios=strat.name
,parameters=list(n=2),verbose=F))

expected_indicator <- runSD(getPrice(mktdata), n=60, sample=TRUE,
cumulative=FALSE)
plot(expected_indicator)
x11();
computed_indicator <- mktdata$SD60
plot(computed_indicator)


Would you know what did I do wrong?
Thanks for any help,
Charles

	[[alternative HTML version deleted]]

