Optimization

The training process of Frankenstein agents is performed
in Tester application(MetaTrader5).

User can either perform optimization manually for each Frankenstein agent,
or delegate most of the work to Optimizator.ex5 - optimization agent.

Automatic optimization is governed by matrices -
frames that contain configurations and input values for training.

The whole point of optimization is to find a pattern on the market and a way to trade it.


Frank EA

Frankenstein.ex5 is a pretty heavy executable in terms of RAM and CPU usage.
Frank.ex5 - Light Weight Version(LWV) - fits best for optimization.

It lacks the GUI and some features, but it's light, fast and much better suited
to be run in Tester.

.set files for all versions of Frankenstein executable follow the same standard and are interchangeable.
First, User runs optimization for Frank.ex5,
then can use the resulting .set file in Frankenstein.ex5 or FrankPro.ex5.


Tester

The common optimization approach is to use Fast Genetic Algorithm on 1 minute OHLC:
tester
tester2
After that, User can calibrate the resulted .set on tick data,
by tuning the parameters a little bit.

As a rule of thumb, we are looking for results with Drawdown value
less than 5% for markets with low volatility, and less than 10-15% for high-volatility markets.
(*when 'risk size' = 10 permille)

Application of other filters is arbitrary,
the highest Profit and reasonable Expected Payoff are good indicators:
tester3


Matrices

On Optimization page you will find
the list of matrices currently registered in the optimization pool(optimization pool is discussed here).
These are the actual matrices running on Frankenstein.pro servers 24/7.

A Matrix is a configuration file, it includes optimization configuration and parameters .set file.
It is used for organizing an automatic scheduled optimization of an agent.

The matrices can be updated, new ones created. Updates happen both automatically and manually.

Note: Only users with administrator rights can make changes on this page!

To compile your own unique system with your own matrices - use Local Installation package.
(See the 'Local Installation' chapter)...

User can download the published matrices and the optimization results(.set files) to trade with them
as is, or use them as building blocks to create an original trading strategy.

To add new matrices, in a single or batch-processing manner, use controls at the top:
matrices

If "Ignite" flag is true, Optimizator(at the backend server) opens a new chart window and starts
a new Frankenstein EA agent.
The flag automatically will be reset after a successful launch attempt.

"On/Off(Activate/Deactivate)" flag activates optimization process for the agent.
If it is set to false, no optimization is performed.
If it is set to true, optimization is performed periodically on a remote server, by a service EA app(Optimizator.ex5).

"Opt_ID" is the identificator of the Optimizator instance managing the optimization of input parameters
for the agent.

Below the list of agents, if you scroll down, you'll see the list of Optimization Results:
matrices2
It contains the results of all runs of the Tester application.

Flag "Is_GOOD" indicates if the optimization frame has successfully passed
filters "Minimal Profit", "Minimal Result", "Minimal Expected Payoff"...:
matrices3

To upload a new matrix file(.set), first choose the target agent, then
choose the .set file on your computer and click "Upload matrix":
matrices4

User(with admin rights) can edit Matrix values, turn on/off optimization of parameters
in the left part of the screen:
matrices5
To the right - values from the resulting .set file are displayed against the initial inputs.

.set file to the right(Optimization Results) contains current parameters values in use by the agent.

To ease the management of parameters, some additional controls can be used.
To quickly turn on/off the specific pattern:
matrices6
To mirror parameters from one pattern to the other(or ALL, if input is empty):
matrices7
To save the changes, download the matrix(.set) or to apply changes to multiple
agents in a batch-manner:
matrices8

Remember, when applying "Save changes to ALL matrices" - all matrices will be updated and
this will trigger reoptimization for all agents.
Use "Save changes to ALL matrices(keep ctms)" to avoid unnecessary reoptimization.


Optimizator

Each matrix represents a single agent installation.
An assigned instance of Optimizator.ex5 manages the optimization process
for the agent. Opt_ID identificator links them together.

Optimizator.ex5 is a service EA running in MT5:
optimizator

Once a matrix for the agent is set up(.set file with input parameters is loaded and the configuration is done),
Optimizator downloads the configuration and performs optimization.
The results are uploaded back to the Frankentein.pro server when they are ready.

The results can also be distributed locally only, if using the Local Installation build of Optimizator.ex5.
(see the "Local Installation" chapter)

When an optimization cycle ends, depending on configuration, Optimizator will either close and re-open the existing
window with FrankPro agent or communicate the results to the agent and let FrankPro to load parameters itself.

To load a new agent optimizator uses file Frank_template.tpl, stored in directory C:\Users\UserName\AppData\Roaming\MetaQuotes\Terminal\***\MQL5\Files\.

If FrankPro loads new parameters run-time it may take some time
(it checks periodically the state, with a period up to 15 mins, so a delay is possible).
This behavior is controlled by IP_IGNITE_MISSING - Ignite Frankensteins automatically? and IP_ignite_close_EA - close the EA before ignition flags.

Once uploaded to Frankenstein.pro,
the results and the new .set can be observed at Optimization page:
matrices9


EA state

Agents download new optimization results automatically,
or read the results locally(for Local Installation).

The EA input parameters are buffered, to see the real, actual parameters in use by the Engine,
click the "params" button in the upper-right corner:
Params_actual

(parameters in the native 'Inputs' subpage are ignored,
they are only in use in ENUM_MANUAL_MODE or in standalone installation)


Common Practices

There's numerous ways how to set up optimization process.

A reasonable approach is to use multiple groups of agents,
each group with unique combination of Optimization Range and Reoptimization Period parameters.

Reoptimize some robots once a week, others once a month, e.t.c...
Use, for example, Optimization Range of 1 month, 3 months, 6 months, years...

There's many active signals on the Market, the wider the search area,
the more good actual signal sources can be found.

Search patterns on different timeframes.

After setting up a configuration, click on Update Config:
matrices10
You can also use batch-processing and copy configurations for multiple agents.
Put "EURUSD,AUDUSD" in Symbols and "1,4,100" in Magics to copy config for
EURUSD_1,EURUSD_4,EURUSD_100,AUDUSD_1,AUDUSD_4 and AUDUSD_100.
Complex requests can be entered, like: "1,2,4,100-110,111,120-129".