I guess it should look like the mql5 version: https://www.mql5.com/en/articles/286
There even the Optimization Results changes if Custom-function is used to optimize but the mt4 b610 does do it yet :(
So I guess it's not working.
It seems that the bugs have not been updated
I want to use RoMad for my custom optimisation and the statistics returned by MQL4 OnTester() gives readings that do not make sense, for example, initial deposit I get 0 and profit gives me a result that is not on the report.
If anyone has come across this issue and has a resolution I would be grateful for the solution
I got this to work with MT4 Version 4.00 Build 1220 (September 2019) by removing any call to ANY function in OnTester() and selecting "Custom" as the Optimized Parameter on the Testing tab in the Expert Properties window.
Luckily it turns out you can access global variables from the OnTester() event handler without breaking the rules.
For example, the code in OnTester() in a bot under construction calculates the "R Squared" statistic from a linear regression applied to the P/L curve at the end of each run so the curve must be pre-constructed from from OrderProfit() values as each trade closes and the values stored in a global array.
In the case of RoMad it should be possible to store return and maximum drawdown over the period of the return on the fly so they're available as global variables when OnTester() is called.

- 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 just have started an optimization with: Expert properties -Testing Tab: Optimized Parameter: Custom & Genetic algorithm,
and in the EA I wrote:
But all the results of the optimization is 0 (Zero) in the Optimization Graph Tab. What is wrong?
The mql4 Reference writes
BTW it is a bit confusing to write: double OnTester(); as if this were a function without any body like double AccountBalance();
But my solution OnTester(){ ..} isn't rejected by the compiler but only zeros arrive in the Optimization Graph??
Any hint how to use this - or isn't this ready yet?
Gooly