You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Check out the new article: How To Profile MQL5 Code in MetaEditor.
This article profiles a rolling z-score indicator with bands using MetaEditor's built-in sampling profiler. We read the Total CPU and Self CPU columns and follow the heat‑mapped source to the true hotspots, replace window rescans with sliding accumulators, remove a redundant array copy, and honor prev_calculated. The result is the same output with measured samples reduced from roughly 7,050 to 59.
The MetaEditor profiler is a sampling profiler. While your program runs, it interrupts execution many times a second and records which line of which function was executing at that instant. It does not time each function with a stopwatch; it counts how often each line is caught in the act. The numbers you see are sample counts, not microseconds, which matters later when the counts get small.
Be clear about what sampling does and does not show, because it is easy to misread. The profiler measures relative cost, not absolute time: a line credited with 60% of the samples is where roughly 60% of the work happens, but the report will not tell you whether that work took two milliseconds or two hundred. Sampling is also statistical. Catching a line a few thousand times paints a sharp picture; catching it a handful of times does not. So trust the big shares, treat the small ones as approximate, and never read a difference of a few samples as meaningful. That rule decides how I read the very last profile in this article, where the totals have shrunk into the dozens.
You launch it from the Debug menu, which offers two profiling commands.
Author: Shahzaib