Hi,
Thanks for all the efforts to develop and maintain packages.
Recently, I found a discrepancy in Num.Trades from 'tradeStats' function.
In an example below, the number of transactions in maCross demo is 11. 
But the output of tradeStats' is 12. 
I think the output of the function is one more than the real for each symbol.
Please let me know if I am wrong.
Wonjae Lee
> sum(tradeStats("macross")[,"Num.Trades"]) 
[1] 12
> demo(maCross)
 demo(maCross)
 ---- ~~~~~~~
> #########################################################################################################################################################################
> #A simple moving average strategy to evaluate trade efficiency
> #checks on SMA of 50 days and SMA of 200 days
> #Author: R. Raghuraman("raghu"), Brian Peterson
> #########################################################################################################################################################################
> 
> require(quantstrat)
> suppressWarnings(rm("order_book.macross",pos=.strategy))
> suppressWarnings(rm("account.macross","portfolio.macross",pos=.blotter))
> suppressWarnings(rm("account.st","portfolio.st","stock.str","stratMACROSS","initDate","initEq",'start_t','end_t'))
> stock.str='AAPL' # what are we trying it on
> currency('USD')
> stock(stock.str,currency='USD',multiplier=1)
> initDate='1999-12-31'
> initEq=1000000
> portfolio.st='macross'
> account.st='macross'
> initPortf(portfolio.st,symbols=stock.str, initDate=initDate)
[1] "macross"
> initAcct(account.st,portfolios=portfolio.st, initDate=initDate)
[1] "macross"
> initOrders(portfolio=portfolio.st,initDate=initDate)
> stratMACROSS&lt;- strategy(portfolio.st)
> stratMACROSS &lt;- add.indicator(strategy = stratMACROSS, name = "SMA", arguments = list(x=quote(Cl(mktdata)), n=50),label= "ma50" )
> stratMACROSS &lt;- add.indicator(strategy = stratMACROSS, name = "SMA", arguments = list(x=quote(Cl(mktdata)), n=200),label= "ma200")
> stratMACROSS &lt;- add.signal(strategy = stratMACROSS,name="sigCrossover",arguments = list(columns=c("ma50","ma200"), relationship="gte"),label="ma50.gt.ma200")
> stratMACROSS &lt;- add.signal(strategy = stratMACROSS,name="sigCrossover",arguments = list(column=c("ma50","ma200"),relationship="lt"),label="ma50.lt.ma200")
> stratMACROSS &lt;- add.rule(strategy = stratMACROSS,name='ruleSignal', arguments = list(sigcol="ma50.gt.ma200",sigval=TRUE, orderqty=100, ordertype='market', orderside='long'),type='enter')
> stratMACROSS &lt;- add.rule(strategy = stratMACROSS,name='ruleSignal', arguments = list(sigcol="ma50.lt.ma200",sigval=TRUE, orderqty=-100, ordertype='market', orderside='long'),type='exit')
> # if you want a long/short Stops and Reverse MA cross strategy, you'd add two more rules for the short side:
> 
> # stratMACROSS &lt;- add.rule(strategy = stratMACROSS,name='ruleSignal', arguments = list(sigcol="ma50.lt.ma200",sigval=TRUE, orderqty=-100, ordertype='market', orderside='short'),type='enter')
> # stratMACROSS &lt;- add.rule(strategy = stratMACROSS,name='ruleSignal', arguments = list(sigcol="ma50.gt.ma200",sigval=TRUE, orderqty=100, ordertype='market', orderside='short'),type='exit')
> 
> getSymbols(stock.str,from=initDate)
[1] "AAPL"
> for(i in stock.str)
+ assign(i, adjustOHLC(get(i),use.Adjusted=TRUE))
> start_t&lt;-Sys.time()
> out&lt;-try(applyStrategy(strategy=stratMACROSS , portfolios=portfolio.st))
[1] "2001-06-26 AAPL 100 @ 11.88"
[1] "2001-09-06 AAPL -100 @ 8.86"
[1] "2002-01-04 AAPL 100 @ 11.85"
[1] "2002-07-09 AAPL -100 @ 8.77"
[1] "2003-05-15 AAPL 100 @ 9.36"
[1] "2006-06-21 AAPL -100 @ 57.86"
[1] "2006-09-25 AAPL 100 @ 75.75"
[1] "2008-03-06 AAPL -100 @ 120.93"
[1] "2008-05-16 AAPL 100 @ 187.62"
[1] "2008-09-23 AAPL -100 @ 126.84"
[1] "2009-05-13 AAPL 100 @ 119.49"
> end_t&lt;-Sys.time()

	[[alternative HTML version deleted]]

