Thanks, works fine for me in this case.

I am just wondering, however, how to use this solution in case i want to 
set my own order sizing function (e.g. order size based on a % of current 
portfolio equity).

In other words, how to trade my system (above Moving Average, not 
crossover) and use flexible order quantity as well.

Igor Vilček




Joshua Ulrich <josh.m.ulrich@gmail.com> 
25.08.2011 03:16

To
"Brian G. Peterson" <brian@braverock.com>
cc
igor_vilcek_external@tatrabanka.sk, r-sig-finance@r-project.org
Subject
Re: [R-SIG-Finance] Quantstrat - trading not just Crossovers (e.g. Moving 
Average)






On Mon, Aug 22, 2011 at 10:33 AM, Brian G. Peterson <brian@braverock.com> 
wrote:
> On Mon, 2011-08-22 at 17:19 +0200, igor_vilcek_external@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.
>

I just wrote a blog post with an example strategy that uses osMaxPos
and addPosLimit to do this.  Here's the link: http://goo.gl/yBKDr

Best,
Josh

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

--
Joshua Ulrich  |  FOSS Trading: www.fosstrading.com





____________________________________________________________________
Informacie obsiahnute v tomto  dokumente su urcene vylucne pre
potreby jeho adresata. Dokument moze obsahovat informacie chranene
ako bankove alebo obchodne tajomstvo, pripadne informacie
podliehajuce ochrane podla inych pravnych predpisov. Preto Vas v
pripade, ak Vam bol  mylne doruceny, vyzyvame, aby ste sa zdrzali
jeho odtajnenia ci jeho pouzitia pre vlastne potreby. Zaroven si Vas
dovolujeme poziadat, aby ste nas o takomto pripade bez zbytocneho
odkladu informovali a dokument nasledne zlikvidovali.

Information stated in this document is intended only for needs of proper
addressees of this document. This document can contain information
protected as a bank or business secret, or information protected by 
other legal regulations. Thus in case of receiving the document by error,  
we kindly ask you not to disclose, or use the document for your own 
needs. Likewise we kindly ask you to notify us immediately upon such 
a case by sending an email message to the sender's address, and 
subsequently delete the document.

Tatra banka, a.s.
http://www.tatrabanka.sk
Hodzovo namestie 3,  811 06 Bratislava 1 
ICO: 00 686 930
Zapisana v obchodnom registri Okresneho sudu Bratislava I
Oddiel: Sa, vlozka cislo: 71/B
	[[alternative HTML version deleted]]

