Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

IŽd like to use the optimization feature in strategy analyser

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

    IŽd like to use the optimization feature in strategy analyser

    My question is, how can I add my own parameters to it for optimization?

    Because when I add my strategy, I dont see any possible variables from my indicators inside.

    How can I setup the indicator IŽd like to optimize from my strategy to the strategy anaylzer?

    #2
    Hello Uregon,

    Thanks for your question.

    You would need to add public input properties and also add the [NinjaScriptPropertyAttribute] attribute to decorate the property so it is optimizable.

    You may reference how the public properties are added in the SampleMACrossover strategy to see how those inputs are implemented. The strategy also implements those properties to create and use SMA indicators with those properties. Please also see the resources below.

    Creating User Defined Input parameters - https://ninjatrader.com/support/help...d_input_pa.htm

    NinjaScriptPropertyAttribute - https://ninjatrader.com/support/help...yattribute.htm

    We look forward to assisting.

    Comment


      #3
      NinjaTrader_Jim

      Thank you.

      Can you give me an example code with the parabolic SAR ?

      That I can set the strategy parameters in the Optimizer.

      Comment


        #4
        Hello Uregon,

        I would suggest using the Strategy Builder and the View Code button for this purpose.

        You can create input variables of type Double in Inputs and Variables, and then in Conditions and Actions, set up a condition with Parabolic SAR, and use your Input variables to control the Parabolic SAR.

        Then click the View Code button to see the resulting syntax.

        Comment


          #5
          NinjaTrader_Jim I have issues to implement it.
          Can you give me an example code with a random parabolic SAR ?

          And I have an other question. What it if I want all Indicators in my strategy for an optimization ?

          Comment


            #6
            Hello Uregon,

            The same process should be taken:

            1. Add User inputs to the script
            2. Use the User inputs to drive the indicator

            I have recorded an example video showing this in the Strategy Builder:



            Publicly available resources on C# may also be found below:



            For Parabolic SAR, consider adding User Inputs of type double instead of int. (See attached screenshots.)



            Attached Files

            Comment


              #7
              NinjaTrader_Jim Thank you for the effort, that helps me a lot.

              Is there any tutorial where I can see how exactly the Optimization works?

              As example I made now a backtest with Optimization and I have now better results in the Total net profit, but I dont see what this new settings was for the parabolic SAR

              Comment


                #8
                Hello Uregon,

                Documentation on optimizations and a video on running optimizations can be found here - https://ninjatrader.com/support/help...a_strategy.htm

                The best results will appear in the results grid at the top of the Strategy Analyzer, and the parameters chosen for that particular backtest will then populate on the right within parenthesis.

                Click image for larger version

Name:	NinjaTrader_2022-08-10_06-21-27.png
Views:	217
Size:	72.5 KB
ID:	1211679

                Comment


                  #9
                  NinjaTrader_Jim

                  Thank you Jim.


                  Do you have an explanation list for this what it all means?
                  Attached Files

                  Comment


                    #10
                    Hello Uregon,

                    Thank you for your reply.

                    Jim is out of the office today, but this page of our help guide goes over each of the optimization fitness options:



                    Please let us know if we may be of further assistance to you.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by NullPointStrategies, Today, 05:17 AM
                    0 responses
                    46 views
                    0 likes
                    Last Post NullPointStrategies  
                    Started by argusthome, 03-08-2026, 10:06 AM
                    0 responses
                    126 views
                    0 likes
                    Last Post argusthome  
                    Started by NabilKhattabi, 03-06-2026, 11:18 AM
                    0 responses
                    66 views
                    0 likes
                    Last Post NabilKhattabi  
                    Started by Deep42, 03-06-2026, 12:28 AM
                    0 responses
                    42 views
                    0 likes
                    Last Post Deep42
                    by Deep42
                     
                    Started by TheRealMorford, 03-05-2026, 06:15 PM
                    0 responses
                    46 views
                    0 likes
                    Last Post TheRealMorford  
                    Working...
                    X