Whenever I backtest intraday strategies that have an extra 1 minute bar time series added in the "Initialize()" method with the following line of code: "Add(PeriodType.Minute, 1);" I get the following fatal exception before I can finish testing all of my contracts (over 1000 contracts in about 10 different Instrument Lists):
"Error on running backtest: Exception of type 'System.OutOfMemoryException' was thrown."
I was able to even reproduce this error with a copy of the "SampleMACrossOver" strategy that comes pre-packaged with Ninja Trader by adding the line ""Add(PeriodType.Minute, 1);" in its "Initialize()" method.
In my tests of my copy of "SampleMACrossOver", the problem only happens when the line of code is there, and it doesn't happen on the same Instrument List or contract each time.
I am able to use parameters that produce 100,000's of trades when the line of code is not there and everything works great, but I can't use parameters that even products 10,000's of trades when the line of code is there without Ninja Trader crashing.
Ninja Trader doesn't crash until 90% or so of my Instrument Lists have been tested. When I start from the bottom of my Instrument Lists (on the lefthand side of the Strategy Analyzer) and work up, right clicking and backtesting each entire Instrument List at once, NT crashes when I am almost at the top, and when I backtest starting from from the top down, NT crashes when I am almost to the bottom.
My strategies need to have a hidden time series of 1 minute bars to be useful, and I need to test 1000's of contracts at once.
How can I do this in Ninja Trader without it crashing after testing 90% of my contracts?
I have access to the strategy code, and am willing to write ANY memory management code that I need to to get this working.
Perhaps I can use some form of "Remove()" to remove the 1 minute bar time series for contracts that have ALREADY been tested (In initialize of 1 contract, perhaps I could wipe out 1 minute bars that were stored in memory from the backtest with some sort of "Remove()" command)?
Thank you very much in advance!
ChiTrader2000

Comment