Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Optimization fitness programming errors

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

    Optimization fitness programming errors

    Hello. I have doubts on programming optimizer fitnesses.

    I want to use the code structure:

    protected override void OnCalculatePerformanceValue(StrategyBase strategy)
    {
    foreach (Trade t in strategy.SystemPerformance.AllTrades)
    {
    //Code
    }
    }

    but I receive the error: "The type or namespace name 'Trade' could not be found (are you missing a using directive or an assembly reference?)"

    This code works in a regular strategy but not in the optimization.

    #2
    I understand that this piece of code in an optimization fitness:

    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    Name = NinjaTrader.Custom.Resource.NinjaScriptOptimizatio nFitnessNameMaxProfitFactor;
    }

    is used to push the optimization results to the UI. But, what if I want to make my own fitness that doesn't exist in the system?

    Comment


      #3
      Hello Guillembm,

      If you were to declare the following using directive, under #region Using Declarations, does the error referencing the trade object no longer appear?

      Code:
      using NinjaTrader.Cbi;
      If you wanted to make your own fitness, you should see the existing samples under OptimizationFitnesses as reference examples.

      Please let us know if you need further assistance.
      Alan P.NinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by algospoke, Today, 06:40 PM
      0 responses
      2 views
      0 likes
      Last Post algospoke  
      Started by maybeimnotrader, Today, 05:46 PM
      0 responses
      6 views
      0 likes
      Last Post maybeimnotrader  
      Started by quantismo, Today, 05:13 PM
      0 responses
      6 views
      0 likes
      Last Post quantismo  
      Started by AttiM, 02-14-2024, 05:20 PM
      8 responses
      168 views
      0 likes
      Last Post jeronymite  
      Started by cre8able, Today, 04:22 PM
      0 responses
      8 views
      0 likes
      Last Post cre8able  
      Working...
      X