I feel like I'm missing something obvious. I made a strategy that trades based on ES but then places the actual trades on MES. With all the settings set with no commissions, no slippage, etc I would expect the results to be 1/10th of the results from when it's trading the same strategy on ES. I know in practice in live trading this won't be the case for various reasons but the fact I'm seeing a large discrepancy in the results in a perfect environment running a backtest makes me think I'm doing something wrong in the code.
My current approach is this:
- Primary series is set to ES 6/20 15 minute chart.
- During State.Configure I AddDataSeries with MES 6/20 contract.
- In OnBarUpdate if BarsInProgress > 0 then I return because I'm not interested in signals from MES.
- When a long or short signal is generated I use EnterLong/EnterShort with the bars in progress parameter set to 1, and I give it a signal name.
- I immediately SetStopLoss on that signal name.
- I periodically update the stop loss again using the signal name.
And yet, ES generates 7 trades and when I set the second series to MES it generates 25 trades. My best guess is the stop losses are not functioning the way I think they are. Alternatively I thought the indicators I'm using could be getting a second bar series update so I modified their OnBarUpdate functions to also return if BarsInProgress is > 0.
What am I missing or doing wrong? Setting the second data series to ES makes it all function as expected, but whenever I put it on MES as second series I get completely different results.
Thanks in advance,
Andrew.
Comment