MQL4: How to Find Out the Real Drawdown During Tests
Greetings to you, friends forex traders and programmers!
From time to time they ask me questions: how to build a real chart of the drawdown of the adviser during testing. This is a very topical topic, especially for those who like risky methods of money management.
The MetaTrader terminal has a balance chart with equity, and some statistics on testing, but it is not always convenient, and it's good when you have your own, proven tool at hand. Today we will create such an instrument.
What will we do today?
You can try to save the test results as an html file, to which a picture in gif format will be attached:
On this picture, usually, the general balance chart with equity and a bar chart of position volumes are displayed. But if you try to consider the details, then you are unlikely to succeed. The fact is that this is a bitmap image and when you zoom in, all clarity is lost and the lines are blurred:
To be able to increase the graph to infinity, it must be vector. Just in Excel, these are built, and the terminal can easily save files in csv format. Thus, we will create a code with you that will save the data on equity and balance into a separate file, and then build the appropriate graphs:
The method itself and the rules for its use in your advisers are described in detail in the video tutorial. All you need to do is to reproduce the code of the method and insert its call into the right places of the adviser, as it was done in the video tutorial, and then spend 15 seconds to plot the graph in Excel.
The code we wrote in this lesson can be used in any trading advisor. Also, you can quite easily collect and record exactly the information that you are most interested in and build any graphs based on this data.