Hi,
In a backtest for ADI in May 2015, with DataNormalizationMode set to Raw and a Daily resolution, I submit a StopLimitOrder on 5/15/15 with a stop price of 65 and a limit price of 65.26. This order should be filled with the bar from 5/20/15 to 5/21/15 as the High value available in OnData is at 66.85.
This is confirmed by the log output:
2015-05-15 00:00:00 : [5/15/2015 12:00:00 AM - Order Event @ ADI] Status: Submitted; 10; Fill price: 0; Limit Price 65.26; Stop price: 65; Trigger price: ; Message:
2015-05-15 00:00:00 : Order submitted. Status: Submitted
2015-05-16 00:00:00 : Got data on 5/16/2015 12:00:00 AM for 5/15/2015 12:00:00 AM - 5/16/2015 12:00:00 AM; Low: 62.9600; High: 63.9300
2015-05-19 00:00:00 : Got data on 5/19/2015 12:00:00 AM for 5/18/2015 12:00:00 AM - 5/19/2015 12:00:00 AM; Low: 63.0300; High: 63.7100
2015-05-20 00:00:00 : Got data on 5/20/2015 12:00:00 AM for 5/19/2015 12:00:00 AM - 5/20/2015 12:00:00 AM; Low: 63.3000; High: 64.3400
2015-05-21 00:00:00 : Got data on 5/21/2015 12:00:00 AM for 5/20/2015 12:00:00 AM - 5/21/2015 12:00:00 AM; Low: 64.0000; High: 66.8500
If I change the stop price to 64 (instead of 65), the order is being filled at 64.34 on 5/20/15, i.e. it's being filled at the High.
If I change the stop price to 64.35, the order is not being filled, although I would expect it to fill on 5/21/15.
If I change the stop price to 64.35 and the limit price to 66.26 (instead of 66.26), the order is being filled at 66.26 on 5/21/15.
I can't comprehend this behaviour. Am I doing something wrong or is this a bug in the engine?
Please see the attached backtest for the version with the original numbers that's not being filled.
Thanks,Daniel
Daniel Hilgarth
I think I figured it out myself. I found this documentation about the Immediate Fill Model and extending the logging shows that the Close price is above the limit price and it's therefore not executed:
Got data on 5/21/2015 12:00:00 AM for 5/20/2015 12:00:00 AM - 5/21/2015 12:00:00 AM; O: 64.2000; H: 66.8500; C: 66.1800; L: 64.0000
What's the best way to tackle this? Add the equity with Hourly resolution and use a Daily consolidator to get the Daily bars that I actually want for my algorithm? (See example attached)
Derek Melchin
Hi Daniel,
To resolve the issue, either:
Best,
Derek Melchin
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Daniel Hilgarth
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!