I have a strategy that I have been testing with the strategy analyzer. All seems to run fine when I do a single backtest but when I try to optimize this strategy I am running into errors that I believe are due to the Multi-threaded optimization in NT8.
Background, I have a collection List<MyOrderType> that I used to manage both entry and exit orders. I Add entries (ie. Entry Orders) into this list just prior to calling EnterLong() / EnterShort(). Within OnExecutionUpdate() I am searching my collection for the given entry trade and then updating order parameters like AverageFillPrice, etc.
This all works fine when backtesting. But when optimizing I am getting exceptions because the orders are not yet updated in the collection.
I believe this is due to the 4 optimization threads that are running.
How can I make the usage of these collections thread safe for optimization senarios?
Thanks,
Comment