• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Is it possible to randomize the number of iterations in the optimizer?

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

    Is it possible to randomize the number of iterations in the optimizer?

    Hi NinjaTraders,

    I am using a third party package called GeneticSharp to run some Genetic Algorithms on the NT 8. I got it running. But the problem is, NT 8 requires that the NumberofInterations be configured in advance. While the GeneticSharp package has other ways to terminate the algorithm, for example, it would allow the GA to stop after a number of performance stagnation (for example, if the algorithm's performance does not improve after 100 iterations, it will stop).

    So, I set the NumberofIterations as 1/10 of the possible iterations as a compromise, While this certainly undermines the power of a GA.

    So, it it possible to allow some randomness in setting the NumberofIterations? Or, let the program decide how many iterations it needs to run ?


    #2
    Hello wolfcuring, thank you for your post.

    I will submit a suggestion to our development team to take a look at other ways of ending the optimization based on the metadata of the optimization itself. Such as ending the optimization if performance stagnation is detected as mentioned.

    Best regards.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Thank you Chris, hope that become possible soon.

      Comment


        #4
        Hi Chris,

        My new finding is that the NumberOfIteration argument can be circumvented! I do this by set up the NumberofIteration to a very small fraction of possible iterations, for example, 1%, which is impossible to complete the search. While I use the stagnation method to stop the GA, for example, when the performance does not improve in the last 100 iterations, stop the GA. And check whether the stagnation is reached, it always returned True ! I can confirm this, because I used the brute force search to know the best parameter set in before I test the GA. So, even I set the NumberfoIteration to just 1, the GA still reached its stagnation. So I guess that is clear evidence that the NumberofIterations is circumvented.

        Another evidence is that, when I set the GA to stop by exact number of iterations, it is stuck by the last time of iteration. And I guess the Number of iterations set within the GA is in conflict with NumberofIteration set up by the OnOptimize() method.

        By the way, I used the RunIteration() method within the GA I coded.

        Comment


          #5
          Hello wolfcuring, thanks for your reply.

          I'm glad you were able to find a solution. If I can assist any further please let me know. Please also feel free to share your solution with the forum if you wish.

          Kind regards.
          Chris L.NinjaTrader Customer Service

          Comment


            #6
            Hi Chris,

            By the way, is it possible for NT8 to count how many times has the RunIteration() method been called?

            Thank you !
            Best,

            Comment


              #7
              Hello wolfcuring, thanks for your relpy.

              This can be done if you make an Optimizer script, or you could make a copy of an existing one to add a counter.

              Please let me know if I can assist any further.
              Chris L.NinjaTrader Customer Service

              Comment


                #8
                Hi Chris,

                Can you be more specific? Is there a counter come with the NinjaTrader ? I looked elsewhere in C# which seems to be quite complicated.

                Thank you !

                Comment


                  #9
                  Hello wolfcuring, thanks for your reply.

                  A counter can be something like a class level integer variable that you increment. You may review all of the optimizer scripts in the platform, they are located under the "Optimizers" folder in the NinjaScript editor.

                  Kind regards.
                  Chris L.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by w0lverine, Today, 08:22 PM
                  0 responses
                  1 view
                  0 likes
                  Last Post w0lverine  
                  Started by dkbyond, Today, 04:11 PM
                  0 responses
                  5 views
                  0 likes
                  Last Post dkbyond
                  by dkbyond
                   
                  Started by markus3500, Today, 03:29 PM
                  1 response
                  18 views
                  0 likes
                  Last Post NinjaTrader_EricB  
                  Started by bohenriksen, Today, 04:00 AM
                  1 response
                  21 views
                  0 likes
                  Last Post NinjaTrader_Jesse  
                  Started by brett0, Today, 12:33 PM
                  3 responses
                  17 views
                  0 likes
                  Last Post marcus2300  
                  Working...
                  X