Reply

Question for Mark – Genetic Evolution details?

4 replies

mikeyc

Customer, bbp_participant, community, 878 replies.

Visit profile

5 years ago #114067

Hi,

 

I have some questions, what exactly happens during the mutation/mating of strategies in genetic evolution mode?

 

Does it involve two strategies from the initial pool or more than two?

Does it randomly take the entry rule from one and combine it with the exit rule of another?

Does this process change the parameters in any way (like optimization does)?

Is there any randomness and to what during the combination process?

 

I’m trying to understand what is more important to spend time on:

 

  1. Create more random strategies
  2. Spend more time improving and optimizing random strategies
  3. Spend time on genetic building

Having an insight into the details of what happens to the building blocks and rules during the genetic process would help greatly.

 

Thanks,

 

Mike

0

gentmat

Customer, bbp_participant, community, 234 replies.

Visit profile

5 years ago #132028

Hi Mike i think Mark use the Matlab function as he is a developper  . To understand GA you need to read or to take a course for that . 

I ll try to explain what i remember from my university study .

 

Random Pool is picked first and the first random gen will have fitness of lets say 1 … then more comes and it will be given fitness number depending on your criteria chosen for that fitness. 

When all random strategies are created … They algorithm most likely will be turning around the most fit strategy and thats why you see that many strategies looks alike when choosing genetic vs random . Genetic will lead to more similar strategies because of the fitness . 

So lets say its a huge cirle inside it little points … You will see all the points trying to go into place but relatively to that fitness.

 

Now mutation occurs but its so rare 10% is so high . remember Genetic Algorithm is used to find many problem like human evolution .. So mutation happens to human is millions of year in a insignificant way . So you can sat the mutation to 0.1 to be more realistic even in trading . 

 

Now Crossover is the way to solve things faster and this came by many researcher who worked with GA and made it better . Remember also GA is still NAIVE not great way but it really helped even in NASA problems and they found crossover to be the best . 

Crossover will swap A  Z  Y From the chain and begin to swap them it will not change A or B just the combination will make it change logically but as parameters i doubt it will change anything, By theory it should keep A and Z and Y the same and cross them until fitness gets better . 

 

Now is there a default way or better way or settings ? NO 

Its by fact that if you increase the pool number of random generation you will get better genetic results but remember it is time consuming and you need a lot of cpu to do so . (and big pool will sometimes lead to more similar strategy because out of 1000 , 1 of these trades comes always to be best fit here you will be living a circle and u ll have to make it more like 100 pool ) . and sometimes 1000 helps more and indeed it will increase the chance of better strategies ( only that thing might fail u but u can try 1000 or 2000 and check what will happen)

Random can do the same results as genetic but it will take more time to do so … but because SQ consumption of cpu is bit weird i can tell you random is way faster than genetic.

So by theory genetic must be faster but with SQ genetic search consume more time to prepare the pool and crossover and so on . so it leads to the same.

 

Hopefully i tried to help and now MARK will answer but i beleive he will not have any specific settings as even professors and people who created GA still doesnt know what is better settings for the GA .

But most mathematicians agree on 0.1 mutation and 65% cross  

0

mikeyc

Customer, bbp_participant, community, 878 replies.

Visit profile

5 years ago #132031

I suppose the crux of what I’m trying to understand is, does GA just combine bits of two strategies and then see if it is better than the parent strategies, and at what level does it combine the pieces? Is it at the entry, exit, stop loss level, or individual pieces of the entry, exit and stop level logic, and are constants such as period of indicator changed?  Does it combine at the operator/building block levels?

 

Does the GA approach give better results than spending time on improve followed by optimise or is it better to go:

 

Random -> Improve Strategy Parts -> Optimise, and not use GA at all?

0

gentmat

Customer, bbp_participant, community, 234 replies.

Visit profile

5 years ago #132033

I am a dev but didnt write sq but here are the facts of what I beleive is true .
1- Ga combines entery rules lets say strategy 1 has cci > rsi and strategy 2 has wp > bbands
ga will take the fitest of these 2 lets stay str 1 and it does the following
either add or replace or swap
so 1 senario would ne cci>wp
or cci>rsi && wp>bbands
and so on
Ga would do the same for sl and take profit
Ga will not swap order type so it will keep order type of the fitest but only do changes for entery and exit.
2- improver you only use if u have smth in mind to make the search faster .
3- There is no way to answer if random then improve then optimise do better or not. no one will ever answer that unless he is ignorant and think he knows but he doesnt.
Its all about luck and speed , im sure if u have a 200 cores at 50ghz ull get a probability on finding good strategies than a normal user .
random has pro and cons , so GA
-radom pros:
a-very fast specially in sq3 compare to ga
b-can find variety of new combinations different from each other
c-doesn use alot of rams and doesnt wait count then wait few seconds to check fitest then begin processing new generations(speed again)
cons:
a-As its faster to find strategies its slower to find good once as sometimes random find great entery but not great exits so if it was ga such strategy will lead to smth rather than ignored by random
GA pros
1- better in finding solutions for complex problems that would take 400 years to solve could take 1 year with GA. Pro scientists use GA not random to solve problems
GA cons:
-Slow due to sq multithreaded way (it has smth wrong hopefully sq4 is better) . random also use multi cores but it feels much faster
-as i told u before Genetic algorithm problem is that it can circle around the greater fitest and yield infinitly in the same strategies.
this is due to a indicator that gives best fit with any random strategy so ga will be using it always.
to solve that u need to lower the number of random generated pool but remember higher number of random gives better chance of better strategy. its sword with 2 sides
whats best whats better i cant tell even the one who created ga can not tell 🙂
try big pool , try small pool , try only random .
i dont think forex is very complex and random can do it alone .
you just need speed , computer spped. dont bother with improve and optimize just strict bank to stability > 0.85
like this ull get 10 strategies in 1 day and put number of trades > max trades in ur mind , in that way only strategies that are half finished are store and not much work to be dont other than try the strategy on different symbols and different timefrsmes

0

seaton

Customer, bbp_participant, community, 161 replies.

Visit profile

5 years ago #132038

GA’s in general are a way to quickly search large inputs spaces to give results that while are not optimal are usually very good, as opposed to a brute force approach that will take a long time to search the same input space and find the same results, however if you use brute force approach and have enough time you will find the BEST result as you do an exhaustive search so eventually you will find it ultimate result at the Global Maxima, Obviously Random approach is just that, it will randomly search the input space and hopefully come up with something worthwhile.

 

The theory behind GA is that inputs to a large search space are mapped/encoded to a genome (i.e. could be an array or string representing the inputs to be searched), in this case with SQ it is the functions are mapped to form a strategy, and the search space the market, a fitness function based on rules is applied to the genome to determine whats a good result and who gets to survive to the next population, in this case the fitness are the rules you apply, such as profit and draw down and is what determines what strategy gets selected as parents for the next generation.

 

An initial population is created using random generated genomes (or sometimes seeded with pre-populated genomes, i.e. you may have some non optimal solutions you want to further search) and much like the theory of evolution the genomes that are the fitness survive (result of applying the fitness function to each genome in the population ), so only the fitness survive and along with new randomly generated genomes generated to make up the population, crossover and mutation will occur, where with crossover simulates breeding and a pair of parent genomes will swap part of their genome to form the children that go to make up the new generation, each genome in the new population has a small random chance of mutation, this mutation helps the population to not get stuck in local maxima type situations, the fitness function get applied and it all begins again.

 

Over time the overall fitness value of the population usually increases to a point where it won’t increase much further, i.e. fitness stagnation.  When this occurs it’s usually the result of having found a local maxima in the search space and is usually a sign that it can’t evolve further. It is therefore best to start again with a new population to try and fine another local maxima.

 

So to answer your question, in SQ the results using GA VS Random, IMHO is that GA will find profitable strategies quicker that random, however the resulting population will all be similar and may not be any more optimal than random generated strategies so both will need some form of optimisation.   So really both are just a form of searching, just that Ga will find solutions quicker, but the solution found while being good may not be optimal, i.e as is not at global maxima.  What I do is start with random and my top ones there are used to seed GA

 

Many moons ago (back in the late 90’s) for my final undergraduate project I wrote a multitasking OS for embedded systems on the Motorola 68HC11 MPU that used GA as the task scheduler.

 

Stephen…

0

Viewing 5 posts - 1 through 5 (of 5 total)