[R-SIG-Finance] pennyPerShare function not working with Quantstrat rules

Brian G. Peterson brian at braverock.com
Tue Aug 7 10:39:44 CEST 2012

On 08/07/2012 12:32 AM, Danny D wrote:
> I have been trying to figure out why the TxnFees argument does not
> evaluate the pennyPerShare function when it is passed via add.rule. I
> receive the following error..
> out<-try(applyStrategy(strategy=stratBBands ,
> portfolios='bbands',parameters=list(sd=SD,n=N)) )
> Error in rbind(deparse.level, ...) :
>    (list) object cannot be coerced to type 'double'
> In addition: Warning messages:
> 1: In rbind(deparse.level, ...) :
>    mismatched types: converting objects to numeric
> 2: In rbind(deparse.level, ...) : NAs introduced by coercion
> I am using the BBands demo to demonstrate below.
> Am I doing something wrong or is there something wrong with the code?
> Thank you for taking the time to help.

It's a bug (more precisely a missing feature).  We'll try to fix this week.

addTxn takes either a numeric TxnFees argument or a function.  It does 
not evaluate a string *name* of a function to locate the function via 
match.fun.  We'll try to add that feature shortly.


   - Brian

Brian G. Peterson
Ph: 773-459-4973
IM: bgpbraverock

More information about the R-SIG-Finance mailing list