Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Optimization

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

    Optimization

    Is there an option to perform optimization maximizing geometrical mean, if not, is it possible to modify NT to do this manually?

    Thank you.

    #2
    Hello,

    It is not currently possible natively, but is so using custom programming.

    Please see our Help Guide article on Developing Custom Fill and Optimizer Types for more information:

    MatthewNinjaTrader Product Management

    Comment


      #3
      Thank you. It seem easy to program and I have done so but for some reason it does not work properly. I followed your instructions and copied and modified one of the existing optimization files, it is just a few lines. The optimization process is running ok but all values of performance have the same value 1. Did I miss anything?

      Here is my code:

      //
      // Copyright (C) 2006, NinjaTrader LLC <www.ninjatrader.com>.
      //
      #region Using declarations
      using System;
      using System.ComponentModel;
      using System.Drawing;
      using NinjaTrader.Cbi;
      using NinjaTrader.Data;
      using NinjaTrader.Indicator;
      using NinjaTrader.Strategy;
      #endregion

      // This namespace holds all strategies and is required. Do not change it.
      namespace NinjaTrader.Strategy
      {
      /// <summary>
      /// </summary>
      [Gui.Design.DisplayName("max. geo. mean")]
      public class MaxGeoMean : OptimizationType
      {
      /// <summary>
      /// Return the performance value of a backtesting result.
      /// </summary>
      /// <param name="systemPerformance"></param>
      /// <returns></returns>
      public override double GetPerformanceValue(SystemPerformance systemPerformance)
      {
      double gmean = 1;
      for (int i=0;i<systemPerformance.AllTrades.Count;i++)
      {
      Trade myTrade = systemPerformance.AllTrades[systemPerformance.AllTrades.Count - 1 - i];
      gmean = gmean * (1+myTrade.ProfitPercent);
      }
      gmean = Math.Pow(gmean,1.0/systemPerformance.AllTrades.Count);
      return(gmean);
      }
      }
      }

      Comment


        #4
        Hello BoyPlunger,
        Unfortunately custom optimization is beyond what we could support but you can refer to the DefaultOptimizationMethod.cs file located in the folder C:\Users\JMitra\Documents\NinjaTrader 7\bin\Custom\Type\ to get an idea on how to create custom Optimization methods.

        Please let me know if I can assist you any further.
        JoydeepNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        649 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        370 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        109 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        574 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        576 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X