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

Unclear Results in Strategy Analyzer

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

    Unclear Results in Strategy Analyzer

    Hello,

    I did some Strategy Analyzer optimization runs on a NT8 strategy that I created, and almost every time, the top 10 trade results return the exact same 'total net profit', 'total # of trades' and other such metrics.

    Why does that occur and would that make the optimization results questionable in any way?

    Screenshots attached?

    #2
    Hello,

    I just ran another Strategy Analyzer optimization and changed the output to keep the best 100 results, and again, I get the exact same 'total net profit', 'total # of trades' and other such metrics, for all 100 optimization results.

    Screenshot attached.

    Comment


      #3
      Hello i2w8am9ii2,

      Thanks for your post.

      The Strategy Analyzer may give skewed results when running from the Playback Connection, so if that is the case, I would recommend disconnecting from Playback or connecting to your data provider.

      If this does not resolve the matter, I would then suggest testing with the SampleMACrossover strategy. This can help us determine if there is an issue with the strategy or with the platform.

      If you do not see an issue with the SampleMACrossover strategy, I would suggest reviewing the results of the strategy and comparing against a backtest of those parameters without optimizing.

      One more suggestion would be to test with IsInstantiatedOnEachOptimizationIteration set to true if you have this set to false. If this is set to false and you are not resetting class level variables you could run into some issues with strategy behavior.

      Please let us know the results of these tests.

      JimNinjaTrader Customer Service

      Comment


        #4
        Hi Jim,

        Thanks for your reply.

        I was not connected to Playback, Continuum or any other connection when I ran these optimizations.

        I guess that was my issue that created these results?

        I will try again with a Continuum connection.

        Comment


          #5
          Hi Jim,

          I just connected to Ninjatrader Continuum and ran the same optimization on the 6E. I got a larger 'total net profit', but again, the top 100 results had identical metrics. I will try the troubleshooting you suggested.

          Screenshot attached.

          Comment


            #6
            Hi Jim,

            I just ran a Strategy Analyzer optimization on the Sample MA Crossover and the metrics were not identical, as they are on my strategy.

            Screenshot attached.

            I'll try changing IsInstantiatedOnEachOptimizationIteration on my strategy to be set to true.

            Comment


              #7
              Hi Jim,

              The IsInstantiatedOnEachOptimizationIteration setting on my strategy was set to true.

              Not sure I understand what you mean by the following:

              If you do not see an issue with the SampleMACrossover strategy, I would suggest reviewing the results of the strategy and comparing against a backtest of those parameters without optimizing.

              Reviewing the results of my strategy, or the SampleMACrossover strategy?

              And to compare against a backtest of 'those parameters' without optimizing, would that be parameters for the SampleMACrossover strategy, or my strategy?

              My strategy is attached, in case anyone cares to look through it to see if anything is wrong with the code.

              It has been unlocked.

              Thanks for your time.
              Attached Files

              Comment


                #8
                I just ran a standard back-test on my strategy.

                The total net profit, total # of trades and other metrics are identical as my Strategy Analyzer optimization.

                Screenshot attached.

                Comment


                  #9
                  Hello i2w8am9ii2,

                  The strategy is simple enough where I can decipher what is happening.

                  You are not using your user defined inputs throughout your strategy, so optimizing the parameters will not have an effect on the strategy logic. You would need to use these inputs in the strategy logic in order for them to have an effect on the strategy's behavior.

                  Let us know if you have any additional questions.
                  JimNinjaTrader Customer Service

                  Comment


                    #10
                    Hi Jim,

                    Thanks for taking a look at my strategy code, and for your feedback, I appreciate it.

                    I am new to C# programming, to NinjaScript and to Strategy Development and analysis although, so I don't quite understand what you are asking me to do here?

                    How would I use my user defined inputs throughout my strategy?

                    How specifically would I use my inputs in the strategy logic in order for them to have an effect on the strategies behavior?

                    Comment


                      #11
                      Hello i2w8am9ii2,

                      We don't offer programming education services in the support department, but I may suggest using the Strategy Builder to generate a strategy and then to use the View Code button to observe the generated syntax.

                      The Strategy Builder 301 webinar demonstrates using the Builder and creating user defined inputs, and the NinjaScript Editor 401 webinar also shows how to generate a strategy similar to the SampleMACrossover strategy that also uses user defined inputs.

                      You have the inputs created, you just have to use them in your logic. For example:

                      if(DownVolume1 < UpVolume1)
                      Print("This print is in a condition that uses your inputs.");

                      Strategy Builder 301 - https://www.youtube.com/watch?v=HCyt90GAs9k

                      NinjaScript Editor 401 - https://www.youtube.com/watch?v=BA0W4ECyVdc

                      We also document using User Defined Inputs here - https://ninjatrader.com/support/help...d_input_pa.htm

                      Please let us know if you have any questions on the material.
                      Last edited by NinjaTrader_Jim; 10-18-2018, 01:49 PM.
                      JimNinjaTrader Customer Service

                      Comment


                        #12
                        Thanks for the info and links Jim,

                        Comment


                          #13
                          Hi Jim,

                          I tried all night yesterday tweaking my code and then running my strategy in the Strategy Analyzer. Nothing worked.

                          So I did what you suggested and used the Strategy Builder to generate a new strategy and then viewed the code and generated syntax.

                          I created four input parameters to test out: * VolUpInput1 * VolDownInput1 * SetMyStopLoss1 * ProfitTarget1

                          Then I did a couple of Strategy Analyzer runs while using the Continuum data-feed.

                          But my results are the same, the first 50 results have identical metrics (total net profit, total # of trades, gross profit, gross loss, etc.)

                          Attached is a screenshot of my new code. Attached also is my new .cs strategy file.

                          Is the situation here the same? Do I still have the inputs created but are not using them in my code logic?
                          Attached Files

                          Comment


                            #14
                            Hello i2w8am9ii2,

                            You are using the user defined inputs in the logic, but I may now suggest to add prints to observe:

                            1. The values of your user defined inputs so you can see them change with each optimization iteration.
                            2. The values used to evaluate your expressions. This would explain why some logic is always becoming true between iterations.

                            I have a demonstration video on setting up prints in the Strategy Builder, and I will also link some information on additional debugging tips.

                            Debugging with the Strategy Builder - https://www.screencast.com/t/8uvjfM8h

                            Debugging Tips - https://ninjatrader.com/support/help...script_cod.htm

                            Let us know if you have any questions on interpreting the debug output.
                            JimNinjaTrader Customer Service

                            Comment


                              #15
                              Hi Jim,

                              Thanks for the info and links.

                              I will go through the video then try adding prints.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by PaulMohn, Today, 03:49 AM
                              0 responses
                              1 view
                              0 likes
                              Last Post PaulMohn  
                              Started by inanazsocial, Today, 01:15 AM
                              1 response
                              6 views
                              0 likes
                              Last Post NinjaTrader_Jason  
                              Started by rocketman7, Today, 02:12 AM
                              0 responses
                              10 views
                              0 likes
                              Last Post rocketman7  
                              Started by dustydbayer, Today, 01:59 AM
                              0 responses
                              2 views
                              0 likes
                              Last Post dustydbayer  
                              Started by trilliantrader, 04-18-2024, 08:16 AM
                              5 responses
                              23 views
                              0 likes
                              Last Post trilliantrader  
                              Working...
                              X