Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Genetic Optimizer in code

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

    Genetic Optimizer in code

    Hi,

    Is it possible to incorporate the genetic optimizer into strategy code?
    If so, is there any documentation available?

    Many thanks

    Michael

    #2
    Hello,

    Yes, this would be technically possible however we do not have any documentation on this area and would not be able to provide support.

    You can see the methods use in the Genetic Optimizer by going to Documents\NinjaTrader 7\bin\Custom\Type\ an opening the @GeneitcOptimizer.cs file.
    MatthewNinjaTrader Product Management

    Comment


      #3
      Hi Matthew, I too am looking for a way to call GeneticOptimizer from a strategy while it is running to optimize the parameters. Could you provide a hint as to how this might be done? The methods in the @GeneitcOptimizer.cs code are not fully documented, so any tips or code snippets you could provide would be very helpful.

      -Dave

      Comment


        #4
        looking for a hint

        I've made this my pet project over the past few months and without documentation it's really tough. Hopefully some NinjaTraders out there can let me know if i'm going in the right direction:

        What I (think) I know...
        - Strategies are basically C# classes and so can be called from other strategies
        - Optimizer Types are also classes and therefore can (should be able to) be called from a strategy


        What I have so far...
        Code:
        cStrat = new DefaultOptimizationMethod(); // setting up the DefaultOptimizationMethod
        cStrat.Initialize();  // must this be called first?
        cStrat.Optimize(); // there must be more to it than this...
        What I don't know...
        1) how you can pass the parameter values (Min,Max,Increment) to the DefaultOptimizerMethod

        e.g (not sure if this is allowable...)

        //setting the min, max, increment
        cStrat.Parameters[0].Min = 5;
        cStrat.Parameters[0].Max = 55;
        cStrat.Parameters[0].Increment = 1;


        2) how to get trade results back to the calling Strategy from the DeaultOptimizer

        e.g., maybe:
        int Losers = cStrat.Performance.RealtimeTrades.TradesPerformanc e.MaxConsecLoser;

        any and all tips/suggestions are appreciated!


        -Dave

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        105 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        148 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        71 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        125 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        79 views
        0 likes
        Last Post PaulMohn  
        Working...
        X