0

Assuming that I have long position with stop sell level at 75, previous day's OHLC was 95,100, 80,85. Today market gapped down and opened at 65, and finally OHLC was 65,70,55,60. In this case if I put stoplimit order at 75, it is never filled. If I put sell order with pricemethod="limit" at 75, it is filled at 75 despite no trade between 70 and 80 (gap zone), which I think unrealistic. Realistically IF stop sell level > Open or stop buy level < Open THEN it should be filled at open. Does anybody know how to realize this logic?

Hama

1 Answers1

2

Please check that you are running latest quantstrat version r1466; a change was made to the code recently that should fix your problem.

Be aware that a perfect simulation in not possible in OHLC, because the only thing that is sure is that the Open occurred before the Close, but the path between the Open and the Close is unknown. In your example the software should fill your order at min(limit.price, Hi(bar)), which is 70.

HTH,

Jan Humme.

Jan Humme
  • 205
  • 1
  • 3
  • 2
    Jan, thanks a lot for your quick response. I was using version 0.7.7 and found 0.7.8 so tomorrow I will try to run again. however I can not agree with your idea that system should fill the order at high price;70. when market opened at 65 with a big gap, where already exceeding my stop sell level by 10pt, you can never predict market would retrace back to 70 at that time. Only choice is just selling at the market as soon as possible to get out the bad position and to avoid further loss. so the case if stop sell level > Open or stop buy level < Open, system should fill the order at open... – user2410213 May 22 '13 at 17:23