You can't "extract" the drawdown data. You have to track and calculate it yourself in your code (which may be somewhat complex for a beginner coder).
The correct terminology is Maximum Adverse Excursion (MAE), which you can also seen in MT5 backtest reports.
There is an MQL4 example in the CodeBase for calculating the MAE and MFE, but it is somewhat old ...
There is however an updated version on the Russian CodeBase ...
You can't "extract" the drawdown data. You have to track and calculate it yourself in your code (which may be somewhat complex for a beginner coder).
The correct terminology is Maximum Adverse Excursion (MAE), which you can also seen in MT5 backtest reports.
but can't you find the drawdown for each trade similar to this coding? Like every new order. I am looking at each trade, not the sum of all traded drawdown figures. The other codes aren't clear to me.
double max_drawdown; void OnTrade() { if (IsTrade()) { // Get the current account equity double equity = AccountEquity(); // Check if this is a new order or a modification if (IsNewOrder()) { // This is a new order, set the max_drawdown variable max_drawdown = equity; } else { // This is a modification, calculate the drawdown double drawdown = (max_drawdown - equity) / max_drawdown; // Store the drawdown value in an array or file // For example, you can print it to the Experts log Print("Drawdown: ", drawdown); // Update the max_drawdown variable if necessary if (equity > max_drawdown) { max_drawdown = equity; } } } }
No! Your example code is analysing equity drawdown for the whole account for all currently open positions as a batch. It is not calculating individual position's "drawdown" or MAE.
Also, MQL4 does not support the "OnTrade" event handler.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi, i need to extract draw down per trade from an EA. I've had a go at the program (below), but i am not sure how to extract the high and low values between each trade execution. also how would i extract this directly to csv?