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

How to access the NetProfit sum in the Strategy Analyzer?

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

    How to access the NetProfit sum in the Strategy Analyzer?

    Hi Ninjas, since I hit with a limitation of a max number of lines in a code, I`m trying to solve in other way my problem.

    Imagine that you have a code with a certain simultaneous combination of ten or more variables, which each one of them might be -1, 0 or 1. When I run whatever input combination of this variables in the strategy analyzer as a code, I get a result of multiple fields, but the most important to me is the NetProfit, and I´d like to know if I could get this result internally in a variable that I could use, without taking it from the strategy analyzer result page.

    Thanks

    #2
    Hello pstrusi,

    Thank you for your post.

    You can use the TradesPerformance values of GrossLoss and GrossProfit to factor the NetProfit as GrossProfit - GrossLoss.

    You can find the TradesPerformance values at the following link: http://www.ninjatrader.com/support/h...erformance.htm

    Please let me know if you have any questions.

    Comment


      #3
      Thanks Patrick for indicating how to get it, now an obvious question:

      how can I submit in my code, as if it was in the strategy analyzer, certain values in the optimizer, such as: value for Bar, dates set for the study..etc in order to get the NetProfit ?

      Thanks

      Comment


        #4
        Patrick your tip is very useful if working in real time, but how to do when you want to optimize values on historical data?

        Comment


          #5
          Hello pstrusi,

          Thank you for your response.

          In this case you would need to build you own internal calculations within the strategy to do this. Are you trying to do this for when your are backtesting in the Strategy Analyzer or just in running the strategy in real-time and want the historical trade values?

          I look forward to your response.

          Comment


            #6
            When I´m backtesting, thus I must input: Value for Bar, dates...etc In order to automate the code, I need to use those results and then changing certain input values in my code. When I was working until 8 variables there wasn`t problem cause I designed a fix code with 27.000 lines, but now that I need to add more variables I hit a limit.
            Last edited by pstrusi; 07-24-2013, 01:45 PM.

            Comment


              #7
              Hello pstrusi,

              Thank you for your response.

              So I may better assist you in this area please advise why you would not just use the Strategy Analyzer results? What are you attempting to do here? What is the end result? Are you planning to hav ethe data automatically exported to another file?

              I look forward to your response.

              Comment


                #8
                Let me explain it because I'm sure that NT might allow a better way.

                I run a backtest with my code, I get a results, and those results ( with a simple work with them in excel give a Trend depending of the combination of my input variables. After I need to put into my code that for certain combination the code should be: buy, neutral or sell a position. My problem is that I don't know how to automatize using the backtest results into my code in automatic way. As you can see there's a manual work.

                Do you understand it? I hope to have it explained simple

                Comment


                  #9
                  Hello pstrusi,

                  Thank you for your response.
                  Originally posted by pstrusi View Post
                  When I was working until 8 variables there wasn`t problem cause I designed a fix code with 27.000 lines, but now that I need to add more variables I hit a limit.
                  Are you developing this in the Strategy Wizard?

                  I look forward to your response.

                  Comment


                    #10
                    Nope. I have a certain experience programming my codes but I´m not a programmer, just economist who learned some from tutorials, books and being helped by this forum. But Whenever I need to go into more complicated internal dynamics I struggle to do a fine job. However I try to keep my work simple.

                    Patrick I appreciate your help but don't worry if this is out of your duty as support. I'm trying to solve through an excel macro..but since I have to optimize 3^10 combinations and assigning those input into my code, I tried to get support from this limitations in lines of code in NT. Above 80.000 NT begins to give memory-issues.

                    If by any chance you could give me some reference in how to get access to internal results from an historical backtest, let me know

                    Best regards

                    Comment


                      #11
                      Hello pstrusi,

                      Thank you for the additional information.

                      It would not be possible to export the results from the backtest through the script. However, it is possible to pull the TradesPerformance and store these values in an external file to read form on the next run of the strategy.

                      For information on the TradesPerformance values please visit the following link: http://www.ninjatrader.com/support/h...erformance.htm

                      For a reference sample on reading and writing to an external file please visit the following link: http://www.ninjatrader.com/support/f...ead.php?t=3477

                      Please let me know if I may be of further assistance.

                      Comment


                        #12
                        I thank you very much Patrick for your great assistance, as always NT support team is excellent!

                        Regards,
                        ps

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by algospoke, Today, 06:40 PM
                        0 responses
                        9 views
                        0 likes
                        Last Post algospoke  
                        Started by maybeimnotrader, Today, 05:46 PM
                        0 responses
                        7 views
                        0 likes
                        Last Post maybeimnotrader  
                        Started by quantismo, Today, 05:13 PM
                        0 responses
                        7 views
                        0 likes
                        Last Post quantismo  
                        Started by AttiM, 02-14-2024, 05:20 PM
                        8 responses
                        168 views
                        0 likes
                        Last Post jeronymite  
                        Started by cre8able, Today, 04:22 PM
                        0 responses
                        10 views
                        0 likes
                        Last Post cre8able  
                        Working...
                        X