[R-SIG-Finance] Quantstrat - trading not just Crossovers (e.g. Moving Average)

Brian G. Peterson brian at braverock.com
Mon Aug 22 17:33:08 CEST 2011


On Mon, 2011-08-22 at 17:19 +0200, igor_vilcek_external at tatrabanka.sk
wrote:
> Hi,
> 
> I've encountered a problem in quanstrat framework, in case I want to trade 
> not just signalCrossovers (or better said, the modified version of a 
> Crossover). 
> 
> Specifically i would like to e.g. go Long if Price>MovingAverage and Exit 
> if Price<MovingAverage. 
> 
> This means, that if we have on a <b>starting </b>day Price>MovingAverage 
> (not a crossover, just "above"), i want the system to buy immediately on a 
> starting day. However, just once. 
> 
> If i tried sigComparison, this solved the problem with trading immediately 
> on a starting day, but started trading <b>anytime</b> a 
> Price>MovingAverage (every day in a row). 
> 
> To sum up, I need to know how to modify sigCrossover to trade also in case 
> "ABOVE" (not just crossover, e.g. on a start day if condition is met) or 
> how to modify sigComparison to make only 1 Long order (not every day the 
> condition is met, only on 1st and then not until Exit is made).

use osMaxPos and set a maximum position instead of the default osNoOp
order sizing function.

Details in the documentation, or I can work up a quick example later in
the week.

Regards,

  - Brian

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



More information about the R-SIG-Finance mailing list