Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Optimizations not running to the end

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

    Optimizations not running to the end

    Hi,

    When I optimize this strategy (only optimization, not backtest), around 50% of my runs run into the following call to OnTermination before reaching the last day of simulation. This seems random.

    All my functions are in try catch statements and I do not ge any error.

    I do not get any error but I catch the stackTrace when OnTermination is called and here it is:

    Code:
       at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
       at System.Environment.get_StackTrace()
       at StrategyApplication.Skyrim.EndOfSimulation(String message) in c:\Work\Work\code\StrategyApplication\StrategyApplication\Strategies\Skyrim.cs:line 783
       at NinjaTrader.Strategy.SkyrimNTunManaged.OnTermination() in c:\Users\Gamer\Documents\NinjaTrader 7\bin\Custom\Strategy\SkyrimNTUnManaged.cs:line 475
       at NinjaTrader.Strategy.StrategyBase.EnsureLifeTimeStatus(LifeTimeStatus status)
       at NinjaTrader.Strategy.StrategyBase.RunBackTest()
       at NinjaTrader.Strategy.OptimizationMethod.RunIteration(StrategyBase strategy, ParameterCollection currentParameters)
       at NinjaTrader.Strategy.OptimizationMethod.RunIteration(ParameterCollection currentParameters)
       at NinjaTrader.Strategy.OptimizationMethod.RunIterationInThread(Object state)
       at System.Threading._ThreadPoolWaitCallback.WaitCallback_Context(Object state)
       at System.Threading.ExecutionContext.runTryCode(Object userData)
       at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading._ThreadPoolWaitCallback.PerformWaitCallbackInternal(_ThreadPoolWaitCallback tpWaitCallBack)
       at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback(Object state)
    Here is my log
    Code:
    2/1/2013 5:55:41 AM|1|4|Verifying license at primary server...
    2/1/2013 5:55:44 AM|2|4|Session Break (Version 7.0.1000.11)
    2/1/2013 5:55:44 AM|1|4|Current license: Type=Regular State=Verified StartDate=1/20/2013 EndDate=12/30/2099 Collective2 Dtn ESignal External Provider2 Provider3 Provider7 Replay Simulator Yahoo InteractiveBrokers AutomatedTrading AdvancedStrategyManagement BasicEntry Charting LiveTrading SystemDevelopment
    2/1/2013 5:55:44 AM|1|4|Vendor assembly 'log4net' version='1.2.11.0' loaded.
    2/1/2013 5:55:44 AM|1|4|Vendor assembly 'StrategyApplication' version='1.0.0.0' loaded.
    2/1/2013 5:55:54 AM|1|2|Global simulation mode disabled
    2/1/2013 5:55:54 AM|1|4|Order entry hot keys disabled
    2/1/2013 5:55:54 AM|1|2|Optimized CPU performance enabled
    2/1/2013 5:55:54 AM|1|4|Automated trading enabled (port 36973)
    2/1/2013 5:56:57 AM|1|4|Verifying license at primary server...
    2/1/2013 5:57:18 AM|1|4|Verifying license at secondary server...
    2/1/2013 5:57:20 AM|2|4|Session Break (Version 7.0.1000.11)
    2/1/2013 5:57:20 AM|1|4|Current license: Type=Regular State=Verified StartDate=1/20/2013 EndDate=12/30/2099 Collective2 Dtn ESignal External Provider2 Provider3 Provider7 Replay Simulator Yahoo InteractiveBrokers AutomatedTrading AdvancedStrategyManagement BasicEntry Charting LiveTrading SystemDevelopment
    2/1/2013 5:57:21 AM|1|4|Vendor assembly 'log4net' version='1.2.11.0' loaded.
    2/1/2013 5:57:21 AM|1|4|Vendor assembly 'StrategyApplication' version='1.0.0.0' loaded.
    2/1/2013 5:57:51 AM|1|2|Global simulation mode disabled
    2/1/2013 5:57:51 AM|1|4|Order entry hot keys disabled
    2/1/2013 5:57:51 AM|1|2|Optimized CPU performance enabled
    2/1/2013 5:57:51 AM|1|4|Automated trading enabled (port 36973)

    #2
    Hardware

    I am running NT on windows 7 64 bit, 2.8GHZ dual core processor, with 4GB ram.

    Comment


      #3
      benoirat, welcome to our forums - would you mind sending us your logs and trace via Help >> Mail to Support, potentially alongside with a simplified example (without your IP) of the script that we could run here on our end?

      Are you managing any custom resources in your strategy that would require OnTermination calls?

      Comment


        #4
        false alarm

        Sorry after deeper analysis, it ends up there is actually no problem. The multi threading in the optimizer was screwing up my (badly coded) logging, which made me beleive that the optimization was stopping early, which it in fact is not

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        639 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        366 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        107 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        569 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        572 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X