I have coded an strategy that uses many indicators instances on each iteration in the optimization. For example, one iteration can use Stochastics with many K parameters or SMA with many different periods. They are dynamically choosen on each iteration and they can be more than 15 on each indicator. Each iteration will have his own combinations that may be the same or not as other iterations.
In the strategy I use IsInstantiatedOnEachOptimizationIteration = false and I nullify any old reference to indicators in OnLoadedData as documentation suggests, in order to start a fresh iteration.
The optimization works fine with a small time window (many months), but it run outs of memory if I increase it more.
After some debug I found two problems:
1- All used indicators remains in memory until all iterations are finished. It would be nice release that memory at the end of each iteration.
2- The main amount of memory is consumed by Ninjatrader.NinjaScript.Series<T> that comes from indicators. His MaximumBarsLookBack is Infinite because they are normally Plot values. This size increases as soon I increase time window.
I would like to confirm:
1 - If there is a way to release Ninjatrader.NinjaScript.Series on each iteration (may be releasing Indicators cache system).
2 - I do not need all Indicators data available for strategy calculation, for me would be enough MaximumBarsLookBack as TwoHundredFiftySix (even less). But Values are Infinite due: https://ninjatrader.com/support/help...rslookback.htm.
But Is there a way to force MaximumBarsLookBack as TwoHundredFiftySix on Values (in indicators like Stochastic or SMA)?
Or is possible to code a version of those indicators without Plots and use Custom Series instead of Values? It would work?
3 - Any other suggestion it would be wellcommed.
Thank you for your help.
Regards
Comment