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 charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        57 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        143 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        161 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        97 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        276 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Working...
        X