Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Back Test - running out of memory problem

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Strategy Back Test - running out of memory problem

    I'm trying to use one of the supertrend indicators. There are a butch of variants but they all seem to have the same structure. When I add it thus:

    protected override void Initialize()
    {
    Add(AdaptiveSuperTrend(0.92,16200,false));
    }

    It plots OK and the strategy is processed quickly. When I use it in OnBarUpdate() thus:

    if (Position.MarketPosition == MarketPosition.Long && aptiveSuperTrend(0.792,16200,false).Oscillator[1] == 0.0 )
    {
    ExitLong("allLongs","");
    }

    The strategy takes forever to run. If the numbers of days is say 50 days of 1min bars then Ninja crashes with an out of memory warning.

    When I added the plot using Add(AdaptiveSuperTrend(0.92,16200,false)) a dataseries object must have been created. Is there a way I can access it to avoid calling AdaptiveSuperTrend(0.92,16200,false) for each iteration of the backtest.

    Here is the message from the log file:

    5/21/2013 12:22:35 AM|3|128|Error on calling 'OnBarUpdate' method for strategy 'New/66d0fc7216204c768b0d7749e5b96906': Exception of type 'System.OutOfMemoryException' was thrown.
    Last edited by boreland; 05-20-2013, 10:27 PM.

    #2
    boreland, If I recall correctly this custom script wasn't pretty efficiently coded to begin with....

    You could check into something like this to see if it would help improving performance -

    // Vars region
    private AdaptiveSuperTrend myInd;

    // OnStartup
    myInd = AdaptiveSuperTrend(0.92,16200,false);

    And then change your code in OnBarUpdate() to only refer to this myInd instance of the indicator.

    Comment


      #3
      Thanks that did the trick.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by argusthome, Yesterday, 10:06 AM
      0 responses
      20 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      18 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      14 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      9 views
      0 likes
      Last Post TheRealMorford  
      Started by Mindset, 02-28-2026, 06:16 AM
      0 responses
      38 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Working...
      X