Discussion of article "Genetic Algorithms - It's Easy!"

 

New article Genetic Algorithms - It's Easy! is published:

In this article the author talks about evolutionary calculations with the use of a personally developed genetic algorithm. He demonstrates the functioning of the algorithm, using examples, and provides practical recommendations for its usage.

Author: Андрей

 

Greetings everyone!

I hope you enjoyed the article.

I will be glad to hear your tips on how to convert UGA to OOP.

 

I'd like to see if this

 MathSrand((int)TimeLocal());

will work when optimised?

Have you run your library in the tester?

 
zigan :

1) I'd like to see if this will be

MathSrand((int)TimeLocal());

will work when optimised?

2) Have you run your library in the tester?

1) I don't see any reason why it wouldn't work.

2) You cannot give an exhaustive answer to this simple question in two words.

Trader's optimisation problems can be conditionally divided into 2 types: a) "Local problems" and b) "Global problems".

a) Local - a set of all actions of a trader/TS (which, in turn, can also be divided into local tasks) performed on each tick. An example of this type is the first task in the article (solving equations, choosing the optimal option price and other similar tasks). They do not require "future" price history.

b) Global tasks - optimisation of some function of all local tasks (it can be the total profit for the reporting period, drawdown, MO, etc.). The entire price history for the time period being optimised is required. The in-house tester performs exactly this type of tasks.

UGA was designed so as not to depend on the standard tester and can be used for both global and local tasks without changing the algorithm code, including in "homemade" testers. Within the framework of the standard tester UGA can be used without changes only in local tasks. For global tasks it must be modified in the tester.

I have not yet had a need to use the optimisation algorithm in a tester that has its own optimisation algorithm.

Describe your task in general terms and we will consider here ways to solve it.

 

Thanks, joo- interesting work!

Questions have arisen about the practical application of the genetic algorithm

The paper describes:

- finding the maximum/minimum of a function of two variables on a given interval

- finding the maximum of the Profit function (example with ZigZag).

Please give examples of practical trading tasks where you think the algorithm can be useful.

Генетические алгоритмы - это просто!
Генетические алгоритмы - это просто!
  • 2010.05.25
  • Andrey Dik
  • www.mql5.com
В статье автор расскажет об эволюционных вычислениях с использованием генетического алгоритма собственной реализации. Будет показано на примерах функционирование алгоритма, даны практические рекомендации по его использованию.
 
joo :

Describe your problem in general terms and we will look at ways to solve it here.

The problem is simple: I want the srand() function to set the generator to a random starting point each time I run the tester.

It turned out that MathSrand((int)TimeLocal()) sets the generator to the previous (same) initial state at different multiple runs of the tester.

 
zigan :

The task is simple: I want the srand() function to set the generator to a random starting point each time I run the tester.

It turns out that MathSrand((int)TimeLocal()) sets the generator to the previous (same) initial state at different multiple runs of the tester.

TimeLocal gives the time in seconds. When testing, it will be the same generated test time.

Try using GetTickCount. It honestly gives milliseconds and does not emulate anything.

 
stringo :

When testing, it will be the same generated test time.

О! Thank you.

 
yu-sha :

Thanks, joo- interesting work!

Questions have arisen about the practical application of the genetic algorithm

The paper describes:

- finding the maximum/minimum of a function of two variables on a given interval

- finding the maximum of the Profit function (example with ZigZag).

Please give examples of practical trading tasks where you think the algorithm can be useful.

Economic tasks in general and trader's tasks in particular are mostly of optimisation nature.

Traders are constantly searching for optimal parameters of their TS. Here is a far incomplete list of the types of tasks that UGA can help in solving:

-finding optimal parameters of indicators

-finding optimal parameters of MM

-search for optimal settings of filters (any, including search for coefficients in digital filters) in indicators

-training of neural networks of any topology and arbitrary size

-training of committees of networks of any topology and arbitrary size. (a committee is a group of networks independent from each other).

UGA can be used both for solving separate above mentioned tasks and all together at once. So, in order to help you understand the power of UGA, I will say that the possibility of solving the last type of tasks in the list allows you to create models of the brain (as you know, the brain consists of departments).

The list of tasks can go on for a long time, just look at the forum threads.

You can also find roots of equations. :)
 

Cool stuff and well written. I myself have also played with genetic optimisation, but unfortunately I have found few benefits. GA is usually considered as a method of global optimisation. This is true if you have plenty of time to deal with very large colonies, but when time (colony size) is limited, GA, like gradient descent methods, converges to a local minimum, and quite slowly. Of course, compared to methods of blunt search of all possible combinations of input parameters, GA gives an undeniable advantage in speed. One of the wide applications of GA is training of multilayer neural networks with their large number of coefficients. Such networks have a huge number of local minima. For some reason, GAs are considered to be the cure for this evil. But in fact the cure is the applied tool, i.e. multilayer network in this case. It is much easier to choose another tool capable of high classification accuracy (like buy/sell/hold) or regression extrapolation with simple and unambiguous optimisation ;-).

 
gpwr :

1) Cool stuff and well written.

2) I've been playing around with genetic optimisation myself too, but unfortunately I haven't found much benefit. GA is usually considered as a method of global optimisation. This is true if you have plenty of time to deal with very large colonies, but when time (colony size) is limited, GA, like gradient descent methods, converges to a local minimum, and quite slowly. Of course, compared to methods of blunt search of all possible combinations of input parameters, GA gives an undeniable advantage in speed. One of the wide applications of GA is training of multilayer neural networks with their large number of coefficients. Such networks have a huge number of local minima. For some reason, GAs are considered to be the cure for this evil. But in fact the cure is the applied tool, i.e. multilayer network in this case. It is much easier to choose another tool capable of high accuracy classification (like buy/sell/hold) or regression extrapolation with simple and unambiguous optimisation ;-).

1) Thank you for your kind words.

2) I don't doubt your knowledge of the subject, but still, you need some skill in working with genetic algorithms (4th tip in the section of the article "Recommendations for working with UGA" )

UGA was developed as a universal tool that can be used for any optimisation problem (section of the article "A bit of history") without any modifications of the algorithm. It is maximally available for further modifications and adding specific operators. Do you know many optimisation algorithms with such properties?

I don't know why GA is considered to be a panacea for various optimisation problems, I personally don't think so and have never stated it anywhere. Of course, for each specific task you can choose the best optimisation tool both in terms of speed of execution and the final result. UGA has a different goal - to be universal.

I have posted some interesting test functions in the MQL4 forum thread "Test Multivariable Multiextreme Function", one of them is presented in the article.

If you want, you can try to find extrema of the proposed functions using other optimisation algorithms other than GA and post the results here. You are welcome to do so. It will be interesting for everyone and for me in the first place.

PS I recommend you to get acquainted with the algorithm proposed in the article to be convinced of the opposite (in bold), although I have no goal to convince anyone of anything.

Good luck in your research!

Тестовая многопеременная многоэкстремальная функция. - MQL4 форум
  • www.mql5.com
Тестовая многопеременная многоэкстремальная функция. - MQL4 форум