<div dir="ltr">Hi R/Finance community, blotter/quantstrat developers,<div><br></div><div>I'm running the Luxor basic strategy available in the quantstrat package (file demo\luxor.1.strategy.basic.R) with its demo data (.rda files in extdata\GBPUSD), and I don't understand why are successive short trades occurring. This is making the position quantity going above +100,000 (or below -100,000). Is this the expected behaviour of this strategy ? Isn't it supposed to alternate between long and short trades of .orderqty = 100000 each (i.e., enter long, leave long, enter short, leave short, ...) ?</div>
<div><br></div><div>I'm attaching an screenshot of the well-known three panels chart from blotter (output of chart.Posn() function) to quickly visualize this situation, and a .csv file for the order book, per trade stats, market data, transactions table and P&L values.</div>
<div><br></div><div>I'm running this example with revision 1608 of the source repository (svn://<a href="http://svn.r-forge.r-project.org/svnroot/blotter">svn.r-forge.r-project.org/svnroot/blotter</a>), but I observed exactly the same behaviour with previous versions of blotter/quantstrat code, though with different time period of the GBP/USD forex data.<br>
</div><div><br></div><div>Furthermore, with revision 1608 I started to see the following warning messages never seen before:</div><div><div><div><br><div><div>> applyStrategy(<a href="http://strategy.st">strategy.st</a>, <a href="http://portfolio.st">portfolio.st</a>)</div>
<div>Warning: stack imbalance in 'lapply', 14 then 15</div><div>[1] "2002-10-22 02:00:00 GBPUSD 1e+05 @ 1.5447"</div><div>Warning: stack imbalance in 'lapply', 18 then 19</div><div>[1] "2002-10-22 17:30:00 GBPUSD -1e+05 @ 1.5435"</div>
<div>[1] "2002-10-22 17:30:00 GBPUSD -1e+05 @ 1.5447"</div><div>Warning: stack imbalance in 'lapply', 20 then 21</div><div>[1] "2002-10-23 03:00:00 GBPUSD 1e+05 @ 1.5486"</div><div>[1] "2002-10-23 03:00:00 GBPUSD 1e+05 @ 1.5492"</div>
<div>Warning: stack imbalance in 'lapply', 22 then 23</div><div>[1] "2002-10-23 17:30:00 GBPUSD -1e+05 @ 1.5468"</div><div>Warning: stack imbalance in 'lapply', 24 then 26</div><div>Warning: stack imbalance in 'lapply', 28 then 31</div>
<div>[1] "2002-10-24 02:00:00 GBPUSD -1e+05 @ 1.5463"</div><div>[1] "2002-10-24 03:00:00 GBPUSD -1e+05 @ 1.5459"</div><div>Warning: stack imbalance in 'lapply', 34 then 35</div><div>[1] "2002-10-24 11:30:00 GBPUSD 2e+05 @ 1.5484"</div>
<div>[1] "2002-10-24 12:00:00 GBPUSD 1e+05 @ 1.5493"</div><div>Warning: stack imbalance in 'lapply', 37 then 38</div><div>[1] "2002-10-25 04:00:00 GBPUSD -1e+05 @ 1.553"</div><div>[1] "2002-10-25 04:00:00 GBPUSD -1e+05 @ 1.553"</div>
<div>Warning: stack imbalance in 'lapply', 39 then 40</div><div>[1] "2002-10-25 12:00:00 GBPUSD 1e+05 @ 1.5513"</div><div>Warning: stack imbalance in 'lapply', 40 then 42</div><div>[1] "2002-10-27 23:30:00 GBPUSD -1e+05 @ 1.5475"</div>
<div>[1] "2002-10-28 09:30:00 GBPUSD 1e+05 @ 1.5533"</div><div>Warning: stack imbalance in 'lapply', 46 then 47</div><div>[1] "2002-10-28 10:30:00 GBPUSD 1e+05 @ 1.555"</div><div>Warning: stack imbalance in 'lapply', 49 then 50</div>
<div>[1] "2002-10-29 00:00:00 GBPUSD -1e+05 @ 1.5583"</div><div>Warning: stack imbalance in 'lapply', 51 then 53</div><div>Warning: stack imbalance in 'lapply', 54 then 57</div><div>[1] "2002-10-29 07:30:00 GBPUSD -1e+05 @ 1.5572"</div>
<div>[1] "2002-10-29 07:30:00 GBPUSD -1e+05 @ 1.5572"</div><div>[1] "2002-10-29 09:30:00 GBPUSD 1e+05 @ 1.5594"</div><div>Warning: stack imbalance in 'lapply', 60 then 61</div><div>[1] "2002-10-30 05:30:00 GBPUSD 1e+05 @ 1.5568"</div>
<div>[1] "2002-10-30 09:30:00 GBPUSD 1e+05 @ 1.5578"</div><div>Warning: stack imbalance in 'lapply', 63 then 64</div><div>[1] "2002-10-30 11:30:00 GBPUSD -1e+05 @ 1.5568"</div><div>Warning: stack imbalance in 'lapply', 65 then 67</div>
<div>[1] "2002-10-30 13:00:00 GBPUSD 1e+05 @ 1.5579"</div><div>[1] "2002-10-30 19:00:00 GBPUSD -1e+05 @ 1.5558"</div></div></div></div></div><div><br></div><div>Thank you</div><div>Pablo</div></div>