Profiling is a process of gathering application features, such as an execution time of its individual fragments (functions, lines). MetaEditor has integrated means of code profiling allowing a programmer to optimize a source code.
Profiling can be performed on the normal chart of the trading platform, as well as using history data in the Strategy Tester. In the first case, a program is launched on a chart that is updated in real time. You can check the program behavior in real conditions. In the second case, the program is launched in the Strategy Tester in the visual mode. The advantage of this method is that you do not need to wait for real data from a trade server.
Many programs, especially indicators, only perform calculations at the arrival of a new tick (OnTick, OnCalculate). Thus, in order to evaluate performance, you have to wait for new ticks in real time. When profiling using history data, you can immediately provide the required load and test the program performance even on weekends when markets are closed.
After that, a special program version for profiling will be compiled automatically. Depending on the selected profiling type, the program will be launched on a normal chart in the trading terminal or in the Strategy Tester (in the visual mode).
The application is launched on EURUSD H1 chart by default. To select another symbol and period, specify them on "Debugging" tab of MetaEditor options.
After the application has been launched, you should work with it for some time using all its functions to the maximum possible extent. That is necessary to allow profiler to measure functions and application lines execution time.
To get more accurate results of profiling, remove the program from the chart manually instead of using command " Stop profiling".
After profiling completion, its results will be displayed in the special "Profiler" tab of "Toolbox" window. Two modes of viewing the results are available. It is possible to switch between them using the context menu.
In this mode, the profiling results are presented by functions:
The functions types are displayed using the icons:
Apart from the mentioned functions types, the profiler also displays:
To view a function in a file, double left click on it.
The profiler displays only the functions that have been called during the application operation.
In this mode, the data on the application operation time is represented by lines. The lines are grouped by the application functions.
To view a line in a file, double left click on it.
The following commands are available in the context menu: