MFE-Profit Correlation


Hi Everyone,

Does anyone know how to code MFE-Profit Correlation in mql4?Many thanks.

William Roeder  
Since there are no slaves here, there are only two choices: learn to code or pay someone. We're not going to code it FOR you. We are willing to HELP you.

Ok fair enough.Since you said ''We are willing to HELP you'' is this the correct and the complete coding of MFE-Profit Correlation in mql4 ? thanks.

double rLinCorCeoff(double DataArray[], double MAEMFEArray[]) // function header
// code for calculations 

// ---- later in the program

rNetProfMFE=rLinCorCeoff(ProfitLossinDollarsArray,MFEinDollarsArray); // sets variable rNetProfMFE to the value returned by rLinCorCoeff

You may wish to consider regression code from the codebase - I have no idea what MFE profit correlation is.

And the conclusion:

Most of the Championship participants, including the winners, used Take Profit (Profit-MFE Correlation) for a guaranteed profit ("A bird in the hand is worth two in the bush).

It may be noted that losing participants mostly used fixed Stop Loss, while the cluster of the Championship winners shows that most loss-making positions were closed by market.

Trading systems with the MFE-MAE Correlation index close to 1 cannot be interpreted as winning or losing. Such systems are characterized by the simultaneous use of fixed values ​​of Take Profit and Stop Loss for open positions.

Does this mean that Stop Loss and Take Profit should not play a key role in optimizing parameters of trading systems?


The analysis of trade results of Automated Trading Championship 2010 participants shows that you should pay attention to the following factors when optimizing the parameters of your trading systems:

■Profitability - Net Profit, Profit Factor, Recovery Factor and Sharpe ratio are closely connected;

■Stability - values of LR Correlation close to 1 characterize more stable trading and imply greater chance of winning the competition;

■Money Management - large values of AHPR and GHPR are generally not typical of the participants with positive results, since both imply a greater risk in trading;

■Reducing correlation between trade results (Z-Score, Z-Score Probability) - avoid large losing and profitable series, as such series can quickly ruin a trader;

■Methods to fix profits (MFE) and limit losses (MAE) should not be based on strictly set Take Profit and Stop Loss levels.


However the only thing that really matters is the expected return (profit) is greater than expected loss.

See forum discussion


Trading is all about entry and exit...

Trading is all about allot of things to allot of different people.

1st> Gather your data using some of the tool described on page_1 here.

2nd>Once you have the MFE and profit for each trade. Calculate the (Final-Profit vs MFE) ratio as described here.

Correlation (Profits, MFE)=0.99
Relation between returns and the MFE. MFE is abbreviation for Maximum Favorable Excursion. Each trade had its maximal profit and maximal loss between opening and closing. MFE shows profit in the favorable excursion of the price. Each trade is corresponded with its return and with two parameters - MFE and MAE. Thus, we can draw each trade on a plane where MFE is plotted along the Х-axis, the return is plotted along the Y-axis. The closer is the return to the MFE, the more complete was the favorable excursion of the price was used. The straight on the graph shows approximation by function Profit=A*MFE+B. The Correlation(Profits,MFE) allows to estimate relation between the profits/losses and the MFE. The closer to 1 is this value, the better will the trades fit into the approximation straight. The closer to zero it is, the less considerable is this relation. MFE more characterizes the ability to realize potential profit.


That is excllent explanation Ubzen, thank you.One last question to you:

How can I exactly benefit from optimized bin-width histogram mqh file ?


That is excllent explanation Ubzen, thank you.One last question to you:

How can I exactly benefit from optimized bin-width histogram mqh file ?

I don't quite remember the function of all those .mqh files and the person who wrote em is no longer active on this forum. You can try looking at the codes/comments if provided. Ultimately, you'll want to program your own tools with/without all the extras provided in someone else's. We've talked allot about how-to generate (mae/mfe) .csv files try searching.