Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

An easy way to incorporate a strategy performance plot to your strategies...

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

    An easy way to incorporate a strategy performance plot to your strategies...

    I thought I would share a way to include a PnL plot in your strategies.

    I personally find it extremely useful because it allows you to instantly see the results from changing strategy variables and makes it very easy to find the most effective time frame and optimal variables for your strategies.

    To add this to your own strategies simply copy the parts in the code between:

    //-----Copy this to your own strategy

    //-------------


    I hope if enough people find this useful that the NT development team will consider adding similar functionality to the strategy wizard in NT7 because its an almost universally useful feature, relatively simple, yet a PITA to add manually to every strategy.

    Watch how easy it is to find the optimal time frame right from the chart! (might take a moment to load)



    This works the same way for other variables too. Play around with this simple MACD crossover strategy and find the best results for your particular instrument.

    Enjoy!

    Attached Files
    Last edited by Elliott Wave; 05-11-2008, 01:28 AM.

    #2
    Thanks for your contribution. Would you mind posting the file sharing section?

    Comment


      #3
      Thanks Elliott Wave. I can see this can be useful in all sorts of ways.

      Comment


        #4
        Hi,

        I downloaded your PnL test, run it on my NT, but there is no plot...

        Any ideas what´s happening?

        Thanks!

        Comment


          #5
          Originally posted by jriverac View Post
          Hi,

          I downloaded your PnL test, run it on my NT, but there is no plot...

          Any ideas what´s happening?

          Thanks!
          Check if you have any other indicators on the chart. By default the strategy plot goes to panel 2 but if you have an indicator already on that plot with a different scale, you may not be able to see it, even though its there. If thats the case simply use the 'results panel' parameter and stick it on a new panel.

          Comment


            #6
            Hi,

            There is no other indicator. The scale of the panel nş2 goes from 0 to 1.

            Is that correct?

            Thanks!!

            Comment


              #7
              It should autoscale based on the PnL.

              I'm not sure what to suggest.

              Are you using 6.5?

              Have any trades plotted on the chart?

              Comment


                #8
                Hi,

                Yes, I am using NT 6.5 (lastest version, updated 2 days ago), I can see the trades, no other indicators, everything seems to be ok, but no plot...

                I have also tried to include your codes in my strategies (i think your idea is GREAT), but no luck...

                I do not know what happens, but do not bother too much, I will sort it out!!

                Regards

                Comment


                  #9
                  You can try checking the Control Center logs. Perhaps some conflicts have cropped up between indicators.
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #10
                    The log is empty, nothing is said there, but the plot is still not there!

                    Regards,

                    Comment


                      #11
                      Originally posted by jriverac View Post
                      The log is empty, nothing is said there, but the plot is still not there!

                      Regards,
                      You can try this version also http://www.ninjatrader.com/support/f...ead.php?t=4656

                      Comment


                        #12
                        Whitmark's code is the basis for this, so the results should be similar, if that one works for you and this doesn't I'd be curious to know why.

                        That reminds me, maybe I should add the ability to have the PnL plot reset at the start of each day like the original version.

                        Are other people having issues as well, or does it generally work as expected?

                        Before adding this to the file sharing section I'd like to make sure it actually works!
                        Last edited by Elliott Wave; 05-11-2008, 04:41 PM.

                        Comment


                          #13
                          Time for the next episode...

                          I REALLY wish that the strategy performance data could be integrated with the main chart and all of the relevant performance data displayed in a panel below the chart. But in the meantime I've started to use the output window for this task. It's helpful because (like the PnL plot) you can immediately gauge the impact of any changes you make to your strategy.



                          Here's the code. Just add it to the end of the OnBarUpdate section.
                          Code:
                          Print ("----Strategy Performance (all trades)----");
                                      Print ("Net Profit: $ " + (int) Performance.AllTrades.TradesPerformance.Currency.CumProfit);
                                      Print ("Profit Factor: " + Performance.AllTrades.TradesPerformance.ProfitFactor);
                                      Print ("Sharpe Ratio: " + Performance.AllTrades.TradesPerformance.SharpeRatio);
                                      Print ("Drawdown: $ " + (int)Performance.AllTrades.TradesPerformance.Currency.DrawDown);
                                      Print ("Gross Profit: $ " + (int)Performance.AllTrades.TradesPerformance.GrossProfit);
                                      Print ("Gross Loss: $ " + (int)Performance.AllTrades.TradesPerformance.GrossLoss);
                                      Print ("Profits Per Month: $ " + (int)Performance.AllTrades.TradesPerformance.Currency.ProfitPerMonth);
                                      Print ("Largest Winner: $ " + (int)Performance.AllTrades.TradesPerformance.Currency.LargestWinner);
                                      Print ("Largest Loser: $ " + (int)Performance.AllTrades.TradesPerformance.Currency.LargestLoser);
                                      Print ("Max consequetive losers: " + Performance.AllTrades.TradesPerformance.MaxConsecLoser);
                                      Print ("Max consequetive winners: " + Performance.AllTrades.TradesPerformance.MaxConsecWinner);
                                      Print ("Average Trade Duration: " + Performance.AllTrades.TradesPerformance.AvgTradeDuration);
                                      Print ("Max time to recover from drawdown: " + Performance.AllTrades.TradesPerformance.MaxTime2Recover);
                          I've posted an example strategy in the file sharing section.



                          I hope its useful to somebody. Enjoy!
                          Last edited by Elliott Wave; 06-10-2008, 03:41 PM.

                          Comment


                            #14
                            Custom Backtesting

                            Elliot Wave,

                            Good stuff. Thank you for sharing.

                            Why don't we setup a custom class or set this up as a method that can simply be called into any strategy?

                            Also, I could use some help setting up a method that will prove the unrealized max drawdown. On a per trade basis and total trade basis. Profit Factor should also be based on unrealized max drawdown as well (in my opinion) for a more accurate view of the system's performance

                            Thanks again!

                            Comment


                              #15
                              Thanks Mr Wave

                              very nice job.. great tool

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              647 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              368 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              108 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              572 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              573 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X