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 judysamnt7, 03-13-2023, 09:11 AM
            4 responses
            59 views
            0 likes
            Last Post DynamicTest  
            Started by ScottWalsh, Today, 06:52 PM
            4 responses
            36 views
            0 likes
            Last Post ScottWalsh  
            Started by olisav57, Today, 07:39 PM
            0 responses
            7 views
            0 likes
            Last Post olisav57  
            Started by trilliantrader, Today, 03:01 PM
            2 responses
            21 views
            0 likes
            Last Post helpwanted  
            Started by cre8able, Today, 07:24 PM
            0 responses
            10 views
            0 likes
            Last Post cre8able  
            Working...
            X