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 judysamnt7, 03-13-2023, 09:11 AM
      4 responses
      59 views
      0 likes
      Last Post DynamicTest  
      Started by ScottWalsh, Today, 06:52 PM
      4 responses
      36 views
      0 likes
      Last Post ScottWalsh  
      Started by olisav57, Today, 07:39 PM
      0 responses
      7 views
      0 likes
      Last Post olisav57  
      Started by trilliantrader, Today, 03:01 PM
      2 responses
      22 views
      0 likes
      Last Post helpwanted  
      Started by cre8able, Today, 07:24 PM
      0 responses
      10 views
      0 likes
      Last Post cre8able  
      Working...
      X