Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Use a input parameter from from strategy in Optimization fitnesses

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

    Use a input parameter from from strategy in Optimization fitnesses

    How can I use a input parameter from from strategy in Optimization fitnesses? I would like to use “QTD_Max” in an Optimization Fitnesses calculation

    [NinjaScriptProperty]
    [Range(1, int.MaxValue)]
    [Display(Name="QTD_Max", Order=2, GroupName="Parameters")]
    public int QTD_Max
    { get; set; }

    #2
    Hello wagner4691,

    Thank you for your post.

    You wouldn't be able to directly access the parameter from the Optimization Fitness script. You could try creating a public static variable in an addon. You could then assign the value of the parameter to it from your strategy, and access it from your Optimization Fitness. I will put together a test script and will reply back with that on Monday.

    Thanks in advance; I look forward to assisting you further.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Hello wagner4691,

      Thank you for your patience.

      I've created three example scripts to show you how you could get this value in your optimization fitness script. One: a modified version of MySharedMethodsExample that creates a static int variable that may be accessed from any other script; two, a strategy that assigns a value to that variable called "TestSharedInt", and an optimization fitness script that just prints the current value of the variable when used while optimizing the TestSharedInt strategy called TestOptFitness.

      If you import these, you can test this out to see it working by running an optimization on TestSharedInt and selecting the TestOptFitness Optimization Fitness and viewing the output in a NinjaScript Output window. You can use this same idea with your script to get your parameter from your Strategy in your own Optimization Fitness.

      Please let us know if we may be of further assistance to you.
      Attached Files
      Kate W.NinjaTrader Customer Service

      Comment


        #4
        Thank you very much.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by junkone, Today, 11:37 AM
        0 responses
        2 views
        0 likes
        Last Post junkone
        by junkone
         
        Started by quantismo, 04-17-2024, 05:13 PM
        5 responses
        34 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by proptrade13, Today, 11:06 AM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Started by love2code2trade, 04-17-2024, 01:45 PM
        4 responses
        34 views
        0 likes
        Last Post love2code2trade  
        Started by cls71, Today, 04:45 AM
        2 responses
        10 views
        0 likes
        Last Post eDanny
        by eDanny
         
        Working...
        X