Gekko Forum
Genetic "algo" - Printable Version

+- Gekko Forum (https://forum.gekko.wizb.it)
+-- Forum: Gekko (https://forum.gekko.wizb.it/forum-13.html)
+--- Forum: Feature Requests (https://forum.gekko.wizb.it/forum-15.html)
+--- Thread: Genetic "algo" (/thread-1460.html)

Pages: 1 2


Genetic "algo" - tommiehansen - 02-10-2018

Implement a genetic algo.

It may sound complex but is basically this:

1. Allow settings to be ranges of min/max so instead of this in the 'Parameters' (UI) @ backtest:

short = 20
long = 50

...it could instead be this:

short = 20,40:5
long = 50,100:10


where X,Y = min/max
and :Z = stepping (in what amounts of steps this value should be changed; this since one woulnd't want to change every possible value by e.g. 1)

Above would simply translate to:

short = min: 20, max: 40, stepping: 5
long = min: 50, max: 100, stepping: 10

2. If there's ranges etc: Run backtests and change value(s) each time (if not, just do a regular backtest)
3. Have the ability to define max amount of runs (where -1 = infinite (or until number of tests runs out); custom setting that works for all strategies e.g. ga_runs = -1

4. Output best performing results -or- output the results that beat the market in some sorted .log or .csv (the latter for easy import/manipulation in 3rd party app e.g. Excel or whatever)

5. Output runs to the log() (so that one know what's happening etc...)

Doable in a reasonably amount of time?
Problem is that the GA-stuff that exist now is tedious, doesn't really work, requires other stuff that doesn't work etc etc ... (tl;dr -- tedious).


RE: Genetic "algo" - tommiehansen - 02-10-2018

Managed to POST to the api and get stuff from a backtest.

It would seem i just have to do a simple UI, and define everything above.
But it's 05:48 in the morning here and haven't slept in 19 hours, so body requires sleep.

Will fiddle more later.


RE: Genetic "algo" - Nima - 02-10-2018

This Javascript GA sounds easy to work. https://github.com/subprotocol/genetic-js
It could help to skip steps 1,3, 4


RE: Genetic "algo" - tommiehansen - 02-10-2018

Sure -- how to use together with Gekko though?

I really have no idea what so ever since the documentation is severely lacking to non-existent.


RE: Genetic "algo" - donkykong017 - 02-10-2018

(02-10-2018, 09:55 AM)tommiehansen Wrote: Sure -- how to use together with Gekko though?

I really have no idea what so ever since the documentation is severely lacking to non-existent.

What do you think about Japonicus (https://github.com/Gab0/japonicus)
Im very new to all this and code and im trying for weeks now to get something out of it.
your strat is the best i have ever seen. so i would be very interested in your opinion


RE: Genetic "algo" - Nima - 02-10-2018

-I am not that prof in javascripting but in genetic-js there are some examples. After installation you can see them also in action.
-japonicus is working meanwhile for me too but still not with adx version.


RE: Genetic "algo" - tommiehansen - 02-10-2018

(02-10-2018, 10:26 AM)Nima Wrote: -I am not that prof in javascripting but in genetic-js there are some examples. After installation you can see them also in action.
-japonicus is working meanwhile for me too but still not with adx version.

After installation? I have yet to have any of them work at all which is really strange since the basic gekko API is quite simple.


RE: Genetic "algo" - Nima - 02-10-2018

i meant after install: npm install genetic-js
let's give another try to Japonicus. It saves time :-)
Japonicus ist working quite well if you get trough the python module installation. Before you install japonicus you need to install python 3.6 and also pip3 It makes the installation easier.

sudo add-apt-repository ppa:jonathonf/python-3.6
sudo apt-get update
sudo apt-get install python3.6

sudo apt-get -y install python3-pip
sudo apt-get install python3.6-tk

you have then run japonicus with python3 instead of python.


RE: Genetic "algo" - tommiehansen - 02-10-2018

Yeah, npm install <stuff>
..is simple. Getting that working though? That's another thing since one would need to write an entire lib on top of that.

Tried what you said, did not work. I know how to install stuff.

The problem i got with these GA-libs is that they do not got the core functionality down which is this:

1. Select a strategy
2. Select max/min/stepping
3. Run

And this:
1. Simple to install and run


RE: Genetic "algo" - Nima - 02-10-2018

my problem was, that the automatic installation skipped some needed libraries or installed them in older versions (in case of python3.6-tk)
the good thing is, that works with your original strategy after modifying settings.py and configSetting.py.
Bad is, that it crashed, when adding adx or other indicators.