I seem to have having trouble with an out of memory error (Exception of type 'System.OutOfMemoryException' was thrown). Any tips on isolating where the memory problem may be coming from?
One thought I had:
Where a Strategy calls a public variable from an indicator does the complete indicator code run? To clarify, a private variable in the strategy is set to equal the called indicator public variable ( e.g. int PrivateVariable = Indicator(args).PublicVariable ), the indicator is not added to the strategy ( e.g. Add(SMA(args) ).
Now, the called indicator code includes some drawn objects (e.g. DrawRectangle, DrawDot). Drawn object are not required for the strategy to run (indicators are applied directly to the charts). In the event the complete indicator code ran, these drawn objects would be consuming memory over the entire life of number of days loaded in the chart from which the strategy was executed. This issue would be compounded in the event the indicator was called on several timeframes of a multi timeframe strategy.
Any suggestions are most welcome.
Shannon
Comment