[R-SIG-Finance] quantstrat maCross demo problem

Brian G. Peterson brian at braverock.com
Fri Jul 13 13:28:02 CEST 2012


On 07/12/2012 08:53 PM, hifin wrote:
> Thanks Brian. Setting orderqty='all' on the exit side solves the problem.
> just wonder if this is a solution for this demo only or if it will cause
> other problems when the strategy is more complicated.

We've tried to correctly process orderqty='all' for risk and exit rules.

I suspect that the issue the -100 fires is that rcit orders can be 
entered before a position exists.  I think another 'fix' for this would 
be to use order sets.  This would give applyRules a 'hint' that the exit 
is tied to an enter that might not already exist.  As I said in my prior 
email, I haven't had/taken the time to look more closely at the root 
cause yet.

> For the root cause, a previous thread mentioned a problem of how applyRules
> handle the order of order types ("entry", "exit", etc). The thread is here
> http://r.789695.n4.nabble.com/quantstrat-tp3208477p3237429.html

Order of operations can always affect things, of course, but I don't 
think it is an issue in this case, as there is no 'enter' rule trying to 
fire on the same timestamp.  Order of operations should be most 
carefully considered on 'stop and reverse' type strategies.

Regards,

   - Brian


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



More information about the R-SIG-Finance mailing list