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

Results tab's results -> Output Window

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

    Results tab's results -> Output Window

    Hey, I want to export (print) all the results from Strategy Analyzer's Results tab to Output window. How can I do that? There's an option to right click on any of the results, then click Export and it exports to .xlsx or .csv file.

    For the selected result (only 1) I was able to achieve that using custom optimization fitness option, but it only prints selected result. How can I print all results to output window?

    I highlighted the area of Results tab in the attached file, in case my explanation was unclear.
    Attached Files

    #2
    Hello UltraNIX,

    Thanks for your reply.

    You can only export the contents of the window/panel you are in.

    In the area you have selected you can export that.

    To export the summary data you would need to right mouse click on the summary page.

    There are no means in NinjaTrader to export each line and the summary data of each.

    I do not know this as a fact but you may want to investigate using a windows automation type app, such as Auto-it, to automate the key sequences to print each page.
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      I have another question - how to call Optimization Parameters value? Like for this Sample MA crossover strategy, when I export Results window, parameters cell has this text:
      Code:
      21/25 (Fast,Slow)
      As my strategy has way more parameters, my questions are:
      1) is there a way to extract the "different" parameter, because when I optimize, I usually optimize 1 parameter at the time, so like in this sample MA crossover strategy, if I only optimize on Fast period, maybe there's a way to code and extract that value of Fast period?
      2) if 1) option seems complicated, another workaround I use with Excel is find 1st and 2nd occurence of "/" (in text like "21/25/50/100 (Fast,Slow,Var2,Var3")to find starting and ending position and extract what's in between (i.e. 25 in this example). How can this be done in Ninja?

      EDIT: All of this is done in Optimization Fitness script, under protected override void OnCalculatePerformanceValue(StrategyBase strategy)
      Last edited by UltraNIX; 08-09-2021, 01:17 PM.

      Comment


        #4
        Hello UltraNIX,

        Thanks for your reply.

        Using Sample MA Crossover FAST parameter:

        protected override void OnCalculatePerformanceValue(StrategyBase strategy)
        {
        Print((strategy as NinjaTrader.NinjaScript.Strategies.SampleMACrossOv er).Fast);
        }

        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_PaulH View Post
          Hello UltraNIX,

          Thanks for your reply.

          Using Sample MA Crossover FAST parameter:

          protected override void OnCalculatePerformanceValue(StrategyBase strategy)
          {
          Print((strategy as NinjaTrader.NinjaScript.Strategies.SampleMACrossOv er).Fast);
          }
          Not exactly. I used this as a sample we are both familiar. But I wanted the answer so I could apply it to my own strategy and my own parameters. So I need a code to print parameters value in Optimization fitness script.

          Comment


            #6
            Hello UltraNIX,

            Thanks for your reply.

            The example can be translated to your strategy, yes?

            Paul H.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_PaulH View Post
              Hello UltraNIX,

              Thanks for your reply.

              The example can be translated to your strategy, yes?
              I will test it out. Previously, I thought it's just a code for SampleMAStrategy, but if I can use any custom strategy of my own, I think I can get a workaround.

              Another thing. I am able to print each result in Output window. But they are not sorted.
              1) I want results to be sorted (and printed) descending by net profit.
              2) I want to add a rank number by net profit (and print it), but for equal net profit I would give equal rank and then jump to next rank without skipping. I.e. If 3 results are $5000, $5000, $4950, it should give ranks of 1, 1, 2.

              Comment


                #8
                Hello UltraNIX,

                Thanks for your reply.

                Correct, the data in the output window is printed solely based on the order of the prints.

                You can code any output your wish, although I think excel is a much better way to go.



                Paul H.NinjaTrader Customer Service

                Comment


                  #9
                  Originally posted by NinjaTrader_PaulH View Post
                  Hello UltraNIX,

                  Thanks for your reply.

                  Correct, the data in the output window is printed solely based on the order of the prints.

                  You can code any output your wish, although I think excel is a much better way to go.


                  Agree, but it takes a way longer to achieve what I want to achieve using excel (at least 3-5 times), so I want to code it once and use indefinately. So can you help me out with sorting and ranking results?

                  Comment


                    #10
                    Hello UltraNIX,

                    Thanks for your reply.

                    Assistance with ranking and sorting would be more of a C# progamming service and we do not provide coding services. If you would like something created for you we can provide a link to 3rd party programmers in the NinjaTrader Ecosystem.
                    Paul H.NinjaTrader Customer Service

                    Comment


                      #11
                      I could adapt somewhat similar I used inside 1 result, using for (int i = 0; i < trades.Count; i++) loop, but I need to know what to put instead of trades.Count, a code for Results (Iterations).

                      Comment


                        #12
                        Hello UltraNIX,

                        Thanks for your reply.

                        There is not a means to loop through the results.

                        The export to a spreadsheet remains the recommendation.



                        Paul H.NinjaTrader Customer Service

                        Comment


                          #13
                          Originally posted by NinjaTrader_PaulH View Post
                          Hello UltraNIX,

                          Thanks for your reply.

                          There is not a means to loop through the results.

                          The export to a spreadsheet remains the recommendation.


                          It is sad. Because I was taught, that anything that is displayed in NinjaTrader, can be accessed and referred, if needed. And not being able is disappointing.

                          Comment


                            #14
                            I was able to replicate optimization iterations to output window. (See attached image below)

                            Now I need to find a way to:
                            1) collect data from Output window to an array/list
                            2) Sort by net profit
                            3) add values to each iteration.

                            I tried using OnMergePerformanceMetric() and OnOptimize() methods, but those are not working with Optimization Fitness script I suppose.
                            Attached Files

                            Comment


                              #15
                              Hello UltraNIX,

                              Thanks for your post.

                              This would be outside our area of support.

                              We will leave this thread open for any forum members to contribute who may have worked in this area.
                              Paul H.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by aligator, 01-06-2022, 12:14 PM
                              2 responses
                              223 views
                              0 likes
                              Last Post john_44573  
                              Started by dmking, 11-12-2019, 12:31 PM
                              4 responses
                              4,140 views
                              0 likes
                              Last Post jasonw
                              by jasonw
                               
                              Started by roblogic, Today, 04:31 PM
                              0 responses
                              8 views
                              0 likes
                              Last Post roblogic  
                              Started by morrnel, 05-12-2024, 06:07 PM
                              4 responses
                              57 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Started by xepher101, 05-10-2024, 12:19 PM
                              6 responses
                              73 views
                              0 likes
                              Last Post xepher101  
                              Working...
                              X