[R-SIG-Finance] Writing sell rules with quantstrat
Sergey Pisarenko
drseergio at gmail.com
Wed Feb 15 18:30:58 CET 2012
Thanks, that's a good idea. I have checked the high prices and I see
that the price does not reach that level. To further troubleshoot I
have changed the profit target to 50% (threshold=1.5). With that in
place I still got very similar results:
> p<-getPortfolio('p')
> p$symbols$B$txn
Txn.Qty Txn.Price Txn.Value Txn.Avg.Cost Pos.Qty Pos.Avg.Cost
2009-01-01 0 0.00 0 0.00 0 0.00
2010-07-07 1000 33.19 33190 33.19 1000 33.19
2010-07-09 -1000 50.61 -50610 50.61 0 0.00
2010-07-09 1000 34.05 34050 34.05 1000 34.05
2010-07-14 -1000 55.32 -55320 55.32 0 0.00
2010-07-14 1000 36.18 36180 36.18 1000 36.18
2010-07-27 -1000 55.65 -55650 55.65 0 0.00
2010-07-27 1000 38.00 38000 38.00 1000 38.00
Prices of 50 are nowhere close to the prices for that time period:
Open High Low Close Volume Adjusted
2010-07-07 32.73 33.22 32.19 33.19 54388300 31.95
2010-07-08 33.79 33.90 32.95 33.74 47070000 32.48
2010-07-09 33.28 34.17 32.12 34.05 48454800 32.78
2010-07-12 35.64 37.00 35.42 36.76 72391600 35.39
2010-07-13 37.72 37.76 35.71 36.88 85975400 35.51
2010-07-14 36.23 36.85 35.70 36.18 45008600 34.83
2010-07-15 36.68 39.81 36.52 38.92 75737600 37.47
2010-07-16 38.52 38.54 37.07 37.10 50505300 35.72
2010-07-19 36.00 36.08 34.58 35.75 55491300 34.42
/Sergey
On Wed, Feb 15, 2012 at 8:41 AM, Brian G. Peterson <brian at braverock.com> wrote:
> On Wed, 2012-02-15 at 08:35 -0800, Sergey Pisarenko wrote:
>> Consequently, this also causes multiple buy transactions to trigger. I
>> would expect the stoplimit orders execute only when the closing price
>> reaches the stoplimit order.
>>
> I'll look at it more closely when I have time, but if the High goes
> through your limit, you will execute at the limit.
>
> Regards,
>
> - Brian
>>
> --
> Brian G. Peterson
> http://braverock.com/brian/
> Ph: 773-459-4973
> IM: bgpbraverock
>
More information about the R-SIG-Finance
mailing list