I did some backtesting today and noticed that with Market Orders I get fill prices that often times can't possibly be right because there are differences of 3, 4 or even more pips from the open price of the candle where it is supposed to be near at.
So, with this
ticket = MarketOrder(symbol, 1000);
Debug("Fill Price: " + ticket.AverageFillPrice);
I get fill prices way too far away from where they should be. I mean, I am working with EURUSD, the most liquid forex pair out there with only a micro lot, there shouldn't any notable slippage or whatever.
What is going on here? Is this due to QuantConnect modelling in fees and slippage? But even then, this is often too much.
Alexander Müller
Maybe I should say that I am working with 3 minute consolidated bars. Does this have to do something with the phenomenon I described above? At what time is a market order actually placed? At the opening of the candle?
Dan Kim
Wow this reply comes almost 4 years later, but here are my thoughts:
Yeah, I think it's basically due to slippage. In the market, there are tons of limit orders at different prices. When you make a large order, it's often not possible to trade every item in the order at the same price because there simply are not enough people on the other end of your order wanting to trade at the price you want to trade.
What I currently suspect is happening is that your order is being filled with a cascading series of prices and what's being reported as the fill price is the average price your order was filled at. I'm actually currently looking into this.
Dan Kim
Actually,
Quoting Alexandre in the post here:
“The default fill model uses L1 data to fill the orders with higher-frequency data (e.g. minute).”
So it could be the fill model doing this.
Alexander Müller
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!