[R-SIG-Finance] quantstrat executes trades that are more worth than total equity

Sergey Pisarenko drseergio at gmail.com
Thu Feb 16 20:22:53 CET 2012

Thank you, Brian. I have read Guy Yollin's lecture yesterday and found
them really useful. I recall seeing the sizing function that
calculated trade size based on current equity. I will use a similar
approach in my custom sizing function.


On Thu, Feb 16, 2012 at 10:25 AM, Brian G. Peterson <brian at braverock.com> wrote:
> On Thu, 2012-02-16 at 09:23 -0800, Sergey Pisarenko wrote:
>> Hi R programmers,
>> I am seeing strange behavior with quanstrat transactions. The problem
>> is that it triggers orders that are larger than the total equity. For
>> example, if I create an account with initial equity of 100 000 I see
>> that rules that exceed the total equity are still executed and
>> reported.
>> Is this the intended behavior? Do I need to write my own sizing
>> function which will take care of this?
> Yes.
> Most institutional and many personal trading accounts use leverage.
> See Guy Yollin's UW lecture slides for an example of equity-aware order sizing rules. Your order sizing function will likely be different, of course.
> When I get a chance I will try to add more information to the
> documentation to make this more clear.
>> I have attached the whole runnable sample script to this e-mail. I
>> have removed all the code which is not relevant to the issue.
> THANK YOU for providing reproducible code.  It makes the task of
> understanding a questions, debugging a problem, and communicating from
> the same position so much easier.
> Regards,
>   - Brian
> --
> Brian G. Peterson
> http://braverock.com/brian/
> Ph: 773-459-4973
> IM: bgpbraverock

More information about the R-SIG-Finance mailing list