[R-SIG-Finance] Blotter : pbm with P&L calculation

Frédéric LABORDERIE flaborderie at yahoo.fr
Thu Sep 9 15:21:19 CEST 2010


hello,
I am trying to port a strategie from Tradestation to R, and I bump into 
what seems to me to be a problem (?).

In the screenshot attached you can see that on June 21st I reverse a 
position from short to long (I buy 2 shares to cancel the short and be 
long) at 111.41, at the close.
So I'm long and bought at 111.41
On July 7th, I reverse again, selling at 106.11.

I expect my transaction to be a loss of 106.11-111.41=-5.30 (Gross 
Transaction Realized PL)

This seems to happen only when testing a Stop And Reverse system, if I 
test a long only or exit a position before taking the opposite, then it 
seems to work (but I could not complete the test because of a lack of 
computer memory)?

So my question is : is this normal behavior ? am I using it incorrectly ?

(I tried to look at the code but could not figure what was wrong, the 
data are SPY from Yahoo)

Thank you for your help
-------------- next part --------------
A non-text attachment was scrubbed...
Name: R blotter - GrossTradinPL.PNG
Type: image/png
Size: 157081 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20100909/0c852e4b/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: flaborderie.vcf
Type: text/x-vcard
Size: 217 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20100909/0c852e4b/attachment.vcf>


More information about the R-SIG-Finance mailing list