Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Genetic Optimizer

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

    #16
    Originally posted by whitmark View Post
    2. It would be nice to accommodate decimal parameter values including decimal increment values since using decimal multiples of ATR, StdDev, Parabolic inputs, for example, are quite common. Given GA parameters can only have integer values if you wanted to optimize a parameter between 1 and 10 in increments of 0.1 the min and max values would need to be converted to 10 and 100 respectively before loading into the GA. When the parameter is used later in the strategy, it is simply divided by 10. If increments of 0.2 was required, the defined min/max values would be 5 and 50 and the actual parameter would be divided by 5 when it is used.
    Doubles are supported. You just can't (yet) specify the increment. The code looks at the data type & rounds double parameters to 2 decimal places. You don't need to do what you are talking about regarding multiplying the params.

    5. Have you considered implementing a parameter stress test feature. If not, you might be interested in learning more about it and how it can promote more stable parameter selection.
    I'll look into this, if you have a link handy feel free to send it along.

    Comment


      #17
      Doubles are supported. You just can't (yet) specify the increment. The code looks at the data type & rounds double parameters to 2 decimal places. You don't need to do what you are talking about regarding multiplying the params.
      Ah yes, I see now after taking a closer look at the code. The GA functions I have used in the past were developed as "integer only" functions, I assumed to standardize and simplify the incrementation/crossover processing since the inputs/increments could have varying degrees of precision. Since you are not beholden to a third-party function you have much more flexibility in how to handle.

      I was first introduced to GA stress testing when using the Grail Genetic Optimizer for TS that is no longer being distributed. I'll pm you some information on the stress testing idea. I wanted to mention too that your fitness function threshold idea for screening multiple instruments would be very useful. I suspect the threshold value could be passed in as a strategy parameter.

      Regards,

      Whitmark
      whitmark
      NinjaTrader Ecosystem Vendor - Whitmark Development

      Comment


        #18
        Money Management combined with SQN

        Hi Pete,

        Since you did such a great job with SQN and the genetic optimizer, I come back to you with another important missing link in NT (to my knowledge): Money Management. This is for me the third pillar that should be implemented.

        Still referring to Van Tharp, as I did for SQN, Money Management is critical to any serious trader in terms of defining the goal he wants to achieve and protecting his capital. Any strategy should include this feature because it is the one which by far will have the largest impact on the final gain. Combined with an optimization based on the SQN number, it is the best way to grow and protect your capital.


        Basically, what should be achieved should go along these lines:

        1. Beeing able to define a level of risk in terms of % of the trading capital. When I speak of capital here, I mean the capital evolving with time after each trade (going up and down according to the result of the previous trade).

        Risk_Capital(%)= n(# of future contracts or stocks)*(Entry($)-Stoploss($))/Capital($)

        A typical value for Risk_Capital is of the order of 1% or less. This could eventually be increased if you have a SQN above 4. Any value above 3% is considered as “financial suicide”.

        By defining Risk_Capital, you will be able to define for each “next” trade the amount of contracts or stocks “n” as:

        n(number of contracts or stocks)= round(Risk_Capital(%)*Capital($)/(Entry($)-Stoploss($))). n has to be greater than 1 or the trade can't be taken.

        By doing this, you see that if you enter in a serie of losing trades, your Capital($) will decrease and n will decrease accordingly. Inversely, if your Capital increase, n will increase also. This is Money Management 101…

        2. Beeing able to impose a minimum reward to risk ratio defined as:

        RewardtoRisk= (MinimumProfitTarget($)-Entry($))/(Entry($)-Stoploss($))

        RewardtoRisk should be higher than 2. Statistically, on a large number of trades, you should not enter a trade if you have not the opportunity to gain at minimum the double of your initial risk.

        Defining the RewardtoRisk allow to calculate the MinimumProfitTarget($) as:

        MinimumProfitTarget($)=Entry($) + RewardtoRisk(>2)*(Entry($)-Stoploss($))

        Today, I don’t see this being clearly defined in NT, so I use the following to optimize strategies on ES:

        Parameters
        ProfitTarget: 24, 512,1
        Stoploss: 1,12,1 (This allow a minimum RtoR of 2 with 24/12)
        These two parameters are used in the window “Stops and Targets” window.
        Very brutal and inefficient way to try to achieve a RtoR above 2 combined with the optimization of the StopLoss and the ProfitTarget.


        Optimize
        Optimize on: my system quality number
        Optimizer: genetic optimizer

        Order Handling
        Entries per direction: 10
        To allow more than 1 entry in a given direction but does not achieve any kind of Money Management.

        Order Properties
        Set order quantity: by strategy

        In the end, in the Order Properties, could it be possible to select a “by Money Management” option that would allow to enter:

        Risk_Capital(%): 0.1%, 1%, 0.1% (min, max, increment)
        RewardtoRisk: 2, 10, 1 (min, max, increment)

        They could be a constant or preferably parameters to be optimized.

        “by Money Management” would compute “n” and “ProfitTarget” for each trade in function of Entry, Stoploss, RewardtoRisk, Risk_Capital and updated Capital.

        Thanks for you feedback.

        Best regards.
        Last edited by Ragingbull; 07-26-2008, 06:06 AM.

        Comment


          #19
          This is such a great piece of work. Thank you for sharing. You are great! I cant believe that this GA did find the best set of paramter in almost 1/1000th of time it would have taken to run thru all the parameters.
          Thanks to you, I can now really focus on making my strategies as flexible as possible and test it for almost any parameter. Do you ever intend to add support for boolean? I think that can be a great asset. And if you add Datetimem then it will help a crazy person like me to find out what is the most optimal time to trade in the market.

          Kudos for the work!!

          Rishi

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Aviram Y, Today, 05:29 AM
          0 responses
          1 view
          0 likes
          Last Post Aviram Y  
          Started by quantismo, 04-17-2024, 05:13 PM
          3 responses
          25 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by ScottWalsh, 04-16-2024, 04:29 PM
          7 responses
          34 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by cls71, Today, 04:45 AM
          0 responses
          6 views
          0 likes
          Last Post cls71
          by cls71
           
          Started by mjairg, 07-20-2023, 11:57 PM
          3 responses
          216 views
          1 like
          Last Post PaulMohn  
          Working...
          X