Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Optimization function - System Quality Number

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

    #16
    Pete,

    I am using:

    SQN= sqrt(N)*average("Profit")/stddev("Profit")

    Please note that since I have a french version of excel, I have translated the name of the function in what I believe is the excel english name.

    Where N is the number of trades and ("Profit") means the N values from the column "Profit" extracted from NT.

    Comment


      #17
      OK, if it is that simple, i will do a little testing with Excel here and see what I come up with. I wrote a version which uses percentage instead of points and the results weren't very different.

      Are you sure you have your commission set up correctly in NT and have use commission = true when you run your strategy?

      Comment


        #18
        Ragingbull -- one thing that jumps out at me right away is that I am using the Excel formula for "STDEVP", not "STDEV", in my code. The difference is STDEV is over (n-1), while my STDEVP is over (n). Can you do a quick test, and substitute STDEVP in your formula, and see if that is what is causing the difference? If you are using a reasonably small n it is possible.

        Next suspect would be the commissions...if this doesn't work out I will investigate further.
        Attached Files

        Comment


          #19
          Pete,

          I am about to leave and won't be back before saturday.

          Effectively, this could make a small difference but don't forget that we are looking here for a set of trades larger than 30.

          To give you an idea, a manual calculation was giving me a SQN of 3 and the program 13 (really too good to be true...) on hundreds of trades! So, in this particular case, the error is probably coming from another place and of another order of magnitude than "n" instead of "n-1". I will check at my return which one should be used anyway.

          Best regards,

          Comment


            #20
            Hmmm...I certainly haven't seen anything like that.

            I am willing to try and figure out what is going on, but I think I will need an example of your data which is producing these results. Is it possible for you to strip out any personal and/or proprietary information from your spreadsheet and email it to me? I'll PM you my email address.

            Comment


              #21
              Hi Pete,

              No problem. How do we proceed?

              Comment


                #22
                PM sent w/my email.

                Comment


                  #23
                  Hm, so you are running with futures, which I don't trade (I developed and tested the optimizer using stocks). After running SampleMA cross against the symbol in your spreadsheet, I can reproduce the behavior you are seeing. I must be making some assumption about the NT data model which is different for futures and stocks. I have what I need to diagnose.

                  Comment


                    #24
                    OK, let's try this. Ragingbull, you want SQN6, that is the version for 6.0. The one called SQN is for 6.5 beta. Instructions are the same as above, make sure you recompile an indicator or strategy after copying the file.

                    I should have just asked you what symbol you were trading, I would have noticed this immediately. I've verified that an excel spreadsheet produces the same result as the trades for both stocks and futures.
                    Last edited by Pete S; 01-20-2008, 09:34 AM. Reason: Delete old versions

                    Comment


                      #25
                      Thanks for sharing guys!

                      PRtester

                      Comment


                        #26
                        Bravo Pete,

                        Excellent job. I made a test on futures with SQN6 and got coherent results with the strategy analyser and a manual cross-checked with Excel.

                        I guess that you have modified the code to make it compatible with stocks and futures now.

                        Have good trades and let me know if it is working fine for you.

                        Comment


                          #27
                          I reposted this here http://www.ninjatrader-support.com/v...ead.php?t=4520 in the file sharing section, please post any followup discussion there.

                          Comment


                            #28
                            Hi Pete,

                            You have to correct the formula in the post because it is not correct. Should be: SQN= sqrt(N)*average("Profit")/stddev("Profit")


                            Best regards,

                            Comment


                              #29
                              Great work Pete S/Raging Bull! It has been on my list to improve the existing "optimizer types" with a similar type of multiple objective fitness function. Thank you for taking up the charge.

                              As you know, the current "default" optimization method is brute force (calculating all parameter iterations), it would be nice to use this type of fitness function to direct the optimization search algorithm and reduce the number of iterations for larger scale optimizations. Are you guys, or anyone else for that matter, planning on taking on development of a genetic algorithm? I have implemented a GA DLL on another platform and the availability of different fill models within NinjaTrader presents some interesting possibilities.

                              Regards,

                              Whitmark
                              whitmark
                              NinjaTrader Ecosystem Vendor - Whitmark Development

                              Comment


                                #30
                                Yes, It is a pity that Ninja people did not take the opportunity to build in a Genetic optimiser into their platform. It would have made it one of the best Strategy platforms on the market.

                                Sunrise

                                PS Ragingbull and Pete S - thank you for this contribution. It has opened my eyes to new ways to work with NT
                                Last edited by Sunrise; 01-20-2008, 05:37 AM.

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by argusthome, 03-08-2026, 10:06 AM
                                0 responses
                                113 views
                                0 likes
                                Last Post argusthome  
                                Started by NabilKhattabi, 03-06-2026, 11:18 AM
                                0 responses
                                60 views
                                0 likes
                                Last Post NabilKhattabi  
                                Started by Deep42, 03-06-2026, 12:28 AM
                                0 responses
                                40 views
                                0 likes
                                Last Post Deep42
                                by Deep42
                                 
                                Started by TheRealMorford, 03-05-2026, 06:15 PM
                                0 responses
                                43 views
                                0 likes
                                Last Post TheRealMorford  
                                Started by Mindset, 02-28-2026, 06:16 AM
                                0 responses
                                81 views
                                0 likes
                                Last Post Mindset
                                by Mindset
                                 
                                Working...
                                X