In certain strategies, I would like to limit the daily number of losing trades. I have implemented the logic to do this by using Performance.AllTrades.Count.
In backtesting, this works great, but live, what seems to happen is that the market orders for entry seem to get executed as several fills. For example, a recent market order for 651 shares worked out to be 300 @ Default, 200 @ Default, 100 @ Default, 51 @ Default. It does this even though it is being executed at the same price. I know this because I have a Print() in OnExecution which shows me the fills and the IExecution.
What happens next is when these trades are closed (by a single market order), this then counts as 4 losing trades rather than just 1. Is there a solution to this?
Thanks
Comment