Thank you Brian. I do really appreciate you kindly clarifying my doubts.


On Sat, Dec 15, 2012 at 1:54 PM, Brian G. Peterson <brian@braverock.com>wrote:

> On 12/15/2012 12:52 PM, Robert A'gata wrote:
>
>> Thanks again Brian. I understand the example well. So if I were to flip my
>>
>> position when my price crosses local VWAP on the opposite side, I will
>> need
>> to set 2 rules, one is to enter into a new position and the other is to
>> exit the previous position? If so, how do I know which rule will be fired
>> first? This is important because says if I was longing and my price
>> crosses
>> VWAP from above the rule to enter a new short will get fired first. Then
>> my
>> total position is 0. Next my exit signal will fire an order of zero size.
>> The right order I'd like the rules to be executed is to exit the existing
>> long and then execute a new short.
>>
>> If there is any better way to do, I'd much appreciate your suggestion.
>> Thank you.
>>
>
> Rules are fired in a particular order.  By default, exits fire first. So a
> stop and reverse approach will first stop, then reverse, because the exit
> rule will be processed before the entry.  You can see that several of the
> examples follow a stop and reverse approach.
>
> You are correct that you are best served by having separate rules for all
> of the combinations.  the 'luxor' series of demos are the most rigorous in
> demonstrating various quantstrat features, and build them up successively
> over time, in much the way that strategy authors tend to start with a
> simple idea, and then add complexity incrementally.
>
> Regards,
>
>    - Brian
>
>
>
> --
> Brian G. Peterson
> http://braverock.com/brian/
> Ph: 773-459-4973
> IM: bgpbraverock
>
> ______________________________**_________________
> R-SIG-Finance@r-project.org mailing list
> https://stat.ethz.ch/mailman/**listinfo/r-sig-finance<https://stat.ethz.ch/mailman/listinfo/r-sig-finance>
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions
> should go.
>

	[[alternative HTML version deleted]]

