[R-SIG-Finance] quantstrat - problems with ordersize function

Andreas Mikkelsen andreas.mikkelsen at stud.hibo.no
Wed Apr 4 17:16:59 CEST 2012


Hi everyone, 

I am currently writing my master thesis in finance . The scope of the thesis
is to backtest on historical data whether the pairs trading strategy is
profitable or not. 

I have a couple of questions regarding the pairs trading demo script in the
quantstrat package.  I managed to run it without any mishap, but as far as I
can see, there are at no time a long / short leg in the transactions.  I.e.
[1] "2009-03-03 SPY 1e+06 @ 67.1509470105226"
[1] "2009-03-09 SPY 1e+06 @ 65.2725988423961"
[1] "2009-03-03 DIA 1e+06 @ 63.717805901226"
[1] "2009-03-09 DIA 1e+06 @ 62.0397741136174"

>From what I can understand it goes long at the same time on both stocks?
Which would not equal a pairs trading strategy. In the summary page of
blotter I could not find a single date with entries on both the long and
short.  Has any one else experienced this? 

Further on I have tried to adjust the script from the package to our needs
with a fellow student and our prof. What we can’t seem to figure out is how
to adjust the orderqty with osFUN. 
What we are trying to do is to make every order a fixed amount with equal
dollar amount on either leg whenever the trade signal is activated. 
Attached is our efforts so far. 
http://r.789695.n4.nabble.com/file/n4532216/Quantstrat_PairTrade11.R
Quantstrat_PairTrade11.R 
Best regards, 
Andreas Mikkelsen


--
View this message in context: http://r.789695.n4.nabble.com/quantstrat-problems-with-ordersize-function-tp4532216p4532216.html
Sent from the Rmetrics mailing list archive at Nabble.com.



More information about the R-SIG-Finance mailing list