Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

can custom criteria be programmed for optimizer?

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

    can custom criteria be programmed for optimizer?

    I am moving from another tool and am "translating" my strategy.
    I have some specific code that I would like to use as a target for optimizing.
    Is this possible?
    Any examples?

    Thanks!

    #2
    Hello waltS,

    Thanks for your post.

    The optimizer will iterate over all user input parameters that have the NinjaScriptProperty attribute added to them. (NinjaScriptProperty is commonly used and also added automatically to user inputs in Strategy Builder strategies. You can also test the SampleMACrossover strategy in the optimizer)

    So, you could make a user input parameter that controls your logic, and then you can add the NinjaScriptProperty attribute to that property to make it optimizable.

    Optimize a strategy - https://ninjatrader.com/support/help...a_strategy.htm

    NinjaScriptProperty attribute - https://ninjatrader.com/support/help...yattribute.htm
    Last edited by NinjaTrader_Jim; 05-31-2022, 06:45 AM.

    Comment


      #3
      Thanks Jim but maybe I did not ask the question properly;
      When on the "strategy analyzer", under the setting "optimize" sub menu, there is a "Optimize on" drop-down where the criteria (like "Max. avg. profit") can be selected.
      I would like to be able to select a user-coded criteria.
      Possible?

      Walt

      Comment


        #4
        Hello Walt,

        That is certainly possible, and easy with an Optimization Fitness Metric.

        The existing Optimization Fitness Metrics are all open source and can be referenced for simple working examples. The OnCalculatePerformanceValue method has a strategy object that can be accessed. Then Value is assigned with the value to be used in the rating.

        Comment


          #5
          Thank Jim, Just what I was looking for...!!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by CarlTrading, 03-31-2026, 09:41 PM
          1 response
          45 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 04-01-2026, 02:41 AM
          0 responses
          21 views
          0 likes
          Last Post CarlTrading  
          Started by CaptainJack, 03-31-2026, 11:44 PM
          0 responses
          31 views
          1 like
          Last Post CaptainJack  
          Started by CarlTrading, 03-30-2026, 11:51 AM
          0 responses
          50 views
          0 likes
          Last Post CarlTrading  
          Started by CarlTrading, 03-30-2026, 11:48 AM
          0 responses
          42 views
          0 likes
          Last Post CarlTrading  
          Working...
          X