Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Interesting issue with optimizer

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

    Interesting issue with optimizer

    Hi,

    This may have been discussed somewhere but I have not found any reference to it.

    The genetic optimizer appears to rerun at the end of the optimization whichever iteration proves to be the best. I can print out the iterations from the genetic optimizer (in the Type folder) and after all the iterations are complete, I get one extra strategy execution with the parameter set from the winning iteration.

    Is there a reason for this or is it "just the way it works" or am I misinterpreting the results?

    I noticed this because I am writing the trade results to a SQL Server database in the genetic optimizer and kept getting duplicate key errors at the very end of the optimization run.

    Best Regards,
    Scott

    #2
    Hi Scott,

    Thanks for the post. I was not able to reproduce this. Attached script, output, and screenshot. The winning result of 7, 25 is only outputted once. Can you think of any changes needed in this test where we could see this occur on our side?
    Attached Files
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Ryan, thanks for getting back to me. I didn't mean it was in the output window (the one you showed in the screenshot) but rather the code executes a second time.

      If you put a print statement in OnStartUp you will see it executes once per iteration and then once again at the end of the optimization.

      Best Regards,
      Scott

      Comment


        #4
        I moved the Print statement to OnStartup() but still get the same results. Winning result 7, 25 is only shown once.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by ScottB View Post
          Hi,

          This may have been discussed somewhere but I have not found any reference to it.

          The genetic optimizer appears to rerun at the end of the optimization whichever iteration proves to be the best. I can print out the iterations from the genetic optimizer (in the Type folder) and after all the iterations are complete, I get one extra strategy execution with the parameter set from the winning iteration.

          Is there a reason for this or is it "just the way it works" or am I misinterpreting the results?

          I noticed this because I am writing the trade results to a SQL Server database in the genetic optimizer and kept getting duplicate key errors at the very end of the optimization run.

          Best Regards,
          Scott
          I do not think that it reruns the best result; it just reports it as a summary. As that summary report is just a duplicate of the actual test run report, it would probably flummox anything that is recording all output, if the records are required to be unique.

          Comment


            #6
            koganam, you may well be correct. I know OnStartUp executed again and the error came out of a method only called in OnBarUpdate but as always, I may have it wrong. Under any circumstances, I was able to fix the issue it was causing with the database.

            I am always loath to fix an issue that may be masking a more subtle yet more serious issue.

            Best Regards,
            Scott

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by bortz, 11-06-2023, 08:04 AM
            47 responses
            1,605 views
            0 likes
            Last Post aligator  
            Started by jaybedreamin, Today, 05:56 PM
            0 responses
            8 views
            0 likes
            Last Post jaybedreamin  
            Started by DJ888, 04-16-2024, 06:09 PM
            6 responses
            18 views
            0 likes
            Last Post DJ888
            by DJ888
             
            Started by Jon17, Today, 04:33 PM
            0 responses
            4 views
            0 likes
            Last Post Jon17
            by Jon17
             
            Started by Javierw.ok, Today, 04:12 PM
            0 responses
            13 views
            0 likes
            Last Post Javierw.ok  
            Working...
            X