Managing optimization processes in real time and transferring massive data from the agents to MetaTrader 5

 

Build 619 of MetaTrader 5 contains the functions for managing the trading strategies optimization that have been announced long ago.

First of all, we consider three new functions of the trading terminal events:

  • OnTesterInit

    The function's task is to initialize an Expert Advisor before the optimization start for further processing of the optimization results.

    OnTesterInit() is TesterInit event handler that is generated automatically before an Expert Advisor optimization start in the strategy tester. An Expert Advisor having OnTesterDeInit() or OnTesterPass() event handler is automatically downloaded on a separate terminal chart during the optimization start and gets TesterInit event. It has the symbol and the period that have been specified in the tester.

  • OnTesterPass

    OnTesterPass() is TesterPass event handler that is generated automatically when receiving a frame during an Expert Advisor optimization in the strategy tester.

    An Expert Advisor having OnTesterPass() event handler is automatically downloaded on a separate terminal chart with a symbol/period specified for testing and gets TesterPass event during the optimization when receiving a frame. The function is designed for dynamic processing of the optimization results right "on the fly" without waiting for its completion. Frames are added by FrameAdd() function that can be called after the completion of a single pass in OnTester() handler.


  • OnTesterDeinit

    OnTesterDeinit() is TesterDeinit event handler that is generated automatically after the Expert Advisor optimization in the strategy tester has been completed.

    An Expert Advisor having TesterDeinit() handler is automatically downloaded on a chart during the optimization start and gets TesterDeinit event after its completion. The function is designed for the final processing of all optimization results.


How can developers benefit from that?

Almost complete control over the optimization processes when the most powerful functions come to the stage:

  • FrameAdd

    Adds a frame on the agent's side having any data types and volumes to transfer them to the control terminal where the data can be read using FrameNext() function. Each frame has string name and long id built-in IDs that are quite useful for the transmitted data separation.

    Now it is possible to transmit both entire files and any data arrays. Moreover, the data is automatically compressed to save the traffic during its network transmission.

  • FrameFilter

    Sets the frames reading filter by name/id fields and relocates the pointer to the beginning. The filters allow to sort out the data obtained from the agents easily, thus simplifying the data access.

  • FrameFirst

    Relocates optimization frames reading pointer to the beginning and resets a previously set filter.

  • FrameNext

    Reads the current frame and moves the pointer to the next one. Can read both clean frames with a single result in the form of double, and data arrays. The arrays are automatically resized fitting in the obtained data volume.

  • FrameInputs

    Input-parameters used for a frame generation are extracted by a pass index.

Below is a sample demonstrating the use of the new possibilities of transmitting the graphic data from the agents to the terminal and the data real-time visualization. The optimization for 100 passes is launched. Each pass returns calculated graphic line with a result. All lines in the terminal are received from the agents, the progress bar is created in real time and the calculated target picture is filled.

The source code is attached.



The link to YouTube video: http://youtu.be/lG0cWCNMGqA

 

Sounds really good. Can we expect an example article on this topic by MetaQuotes in the near future? To present some examples of use.

By the way, could it be used e.g. for automated reoptimization of EA?

 

What is the alternative for MT4 of these functions?

I tried, and   FrameAdd()  not passed the compilation?

 OnTesterInit,OnTesterPass compiled without problems.

 
Sergey Genikhov:

What is the alternative for MT4 of these functions?

I tried, and   FrameAdd()  not passed the compilation?

 OnTesterInit,OnTesterPass compiled without problems.

The alternative is MT5. It's not doable with MT4.
Reason: