[R-SIG-Finance] ruleSignal doesn't want to open a position

Robert A'gata rhelpacc at gmail.com
Thu Dec 27 01:07:45 CET 2012


Hi,

I have a simple strategy that open a position when fast local vwap (vwap1)
crosses above the slow local vwap (vwap2). My mktdata looks like below.

> head(mktdata,2)
                           vwap2  price   vwap1    bid    ask rawsigma
sigma
2012-12-11 19:35:24.637 1710.874 1710.4 1710.58 1710.3 1710.5 56.19804
4.755039
2012-12-11 19:35:24.637 1710.873 1710.4 1710.58 1710.3 1710.5 56.19804
4.755039
                            devsig pvcx.gt pvcx.lt
2012-12-11 19:35:24.637 -0.3609031      NA      NA
2012-12-11 19:35:24.637 -0.3593325      NA      NA


In my code, whenever pvcx.gt=1, I will open a long position with 1 unit of
my stock. However, when running my code (attached with data), quantstrat
doesn't not want to create any order. I also checked that there are 17 rows
where pvcx.gt=1. I do not understand why none of them is triggered. Any
comment would be appreciated. Thank you.

> idx <- which(mktdata$pvcx.gt==1)
> length(idx)
[1] 17
> head(idx)
[1]  213 2363 4104 4241 5793 7054
> mktdata[idx[1],]
                           vwap2  price    vwap1    bid  ask rawsigma
sigma
2012-12-11 19:58:47.615 1710.612 1710.9 1710.614 1710.9 1711 58.92066
4.57865
                             devsig pvcx.gt pvcx.lt
2012-12-11 19:58:47.615 0.002908604       1      NA


Robert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20121226/302cd3a7/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CrossOverVwapRun.R
Type: application/octet-stream
Size: 7097 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20121226/302cd3a7/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: GCv1.zip
Type: application/zip
Size: 195947 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20121226/302cd3a7/attachment.zip>


More information about the R-SIG-Finance mailing list