Modify MT5 ontester function to omit duplicate result values

MQL5 Indicators Experts

Job finished

Execution time 5 days
Feedback from customer
Impossible project, my mistake due to limitations of mql5 ontester function. Despite this Saad put many hours into this project. A* would always recommend.
Feedback from employee
Great collaborating with you once more!

Specification

Hello

I want my custom max forumla used in MT5 modified to check the result, if there is a return value of the same number return zero / void the result to avoid getting mutliple results of the same value similar settings.

  • The problem is i get tons of results of the same value when doing many generic testing runs on MT5 (this is expected and normal)
  • I am looking for a solution when each test / run is complete it checks that the end results value is unique and if so it allows it to pass
  • If the value is a duplicate, it voids the result to 0 (currently I export to excel and remove duplicate rows that have the same result value to manually filter this out)
  • The aim is to only have unique results in the optimisation profile when its complete, allowing for a much faster testing scheme.
  • Note that there are tons of zero values and to avoid dividing by zero errors.
input string OnTester = "------------ Custom Max ------------";        // ------------ Custom Max ------------
input int    MinTrades = 20;                                           // Minimum required trades
input double MaxEquityDrawdown = 5.0;                                  // Maximum allowed drawdown
input string OnTesterEnd = "------------ Custom Max End ------------"; // ------------ Custom Max End ------------

double OnTester(void) {
    // Get the required statistics
    int totalTrades = TesterStatistics(STAT_TRADES);
    int profitTrades = TesterStatistics(STAT_PROFIT_TRADES);
    int lossTrades = TesterStatistics(STAT_LOSS_TRADES);
    double totalProfit = TesterStatistics(STAT_PROFIT);
    double profitFactor = TesterStatistics(STAT_PROFIT_FACTOR);
    double equityDrawdownPercent = TesterStatistics(STAT_EQUITY_DDREL_PERCENT);

    // Calculate the target drawdown as 50% of the MaxEquityDrawdown
    double TargetEquityDrawdown = MaxEquityDrawdown * 0.5;

    // Check the conditions for voiding the results
    if (totalTrades < MinTrades || equityDrawdownPercent > MaxEquityDrawdown || lossTrades == 0) {
        return 0; // Void the result if not meeting trade or drawdown criteria, or no losing trades
    }

    // Calculate the trade win ratio
    double tradeWinRatio = (double)profitTrades / (double)lossTrades;

    // Adjusted drawdown impact calculation
    double drawdownImpact = 1 - fabs(equityDrawdownPercent - TargetEquityDrawdown) / TargetEquityDrawdown;
    drawdownImpact = MathMax(0, drawdownImpact); // Ensure drawdown impact is not negative


    // Apply the new formula with adjusted drawdown impact
    double finalCriterion = (totalProfit / equityDrawdownPercent) * (profitFactor / tradeWinRatio) * drawdownImpact;

    return finalCriterion;
}

Responded

1
Developer 1
Rating
(117)
Projects
136
22%
Arbitration
5
0% / 60%
Overdue
3
2%
Loaded
2
Developer 2
Rating
(73)
Projects
91
34%
Arbitration
8
88% / 0%
Overdue
0
Loaded
3
Developer 3
Rating
(163)
Projects
193
48%
Arbitration
2
50% / 50%
Overdue
1
1%
Free
4
Developer 4
Rating
(4)
Projects
6
0%
Arbitration
5
0% / 80%
Overdue
2
33%
Free
5
Developer 5
Rating
(250)
Projects
400
38%
Arbitration
82
41% / 20%
Overdue
69
17%
Loaded
6
Developer 6
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
Similar orders
I am looking to create an automated trading system that runs on meta trader 4. I currently have 200 clients on an automated trading system with over £200,000 in capital and wanting to funnel this into my own trading system. Looking to find someone who can program a bot that will trade on Meta Trader 4, potentially look at the source code of the system we currently use and utilize that
I want you to create a Robot copier from mt4 to ctrader with the following features: 1. mt4- mt4 2. mt4-ctrader + mt4 master sends signal +Ctrader Client & mt4 Client Copy 1-1 Edit Lots Copy (1-input) Close the entire order when positive $ (input) Close the entire order when negative $ (input) Stop trading when daily profit is greater than $(input)
I would like you to create a deriv Forex scalping Robot to trade on smaller accounts starting from $50-$100. The robot is meant to trade deriv synthetic indices ( specifically Volatility 75(1s ) ). Note: Remember that deriv indices are open 24/7 including on weekends , so the robot should work even on weekends and it should have news filters . I want the ROBOT to be entering the market 3-5 times a day until the set
This is a Ready Made grid Automatic EA 1 Need some bug fixing and little modification. 1. This Grid EA has some bug like -After MT4 Restart the EA place 4-5 random trade at the same strike price without any logic. plz fix this bug 2. add RSI for buy sell https://drive.google.com/file/d/1f1_MJR2KoKCAPIlNohvnhaC0NqC6bQ2T/view?usp=sharing Here is a short video. what kind of problem i face
Hello, I have an EA working nice but I required some modification / additions in it. Addition / Modification! 1. EA must follow the Buy - Sell Arrow Alert indicator (copy of Arrow indicator attached) in combination of Heiken Ashi candles and Stochastic Oscillator Indicator to Buy / Sell orders 2. Placing X number of pending orders with an initial distance and proportional increase in distance and lot size. 3. Close
I'm looking for someone who will take the source code of an existing trading bot and make some adjustments and tweaks to it. Mostly is about changing the UI and basic default parameters. No need to change the algorithm itself. The result must be a file that I can install as any other expert advisor in the MT4 terminal. For now I can share the more detailed task in my video
Hello I have purchased an EA from MQL market. The name of the EA is "Eternal Profit" and it works on MT4 only. Its available in market and you can still find it to run DEMO. Though I have purchased the EA but its not working properly for XAUUSD pair owing to some inherent programming issues in the EA. The same EA is working good on currency pair. The key issue is the decimal place in in the pair. Its designed for
Grid EA for MT5 60 - 70 USD
Hi, Coding Skills Required: Experience in coding trading robots for MT5. Ability to implement increasing coefficients for the distance between orders and lot size 1. Project Objective: Develop an automated trading robot for MetaTrader 5 (MT5) as per the specified trading strategy. 2. Trading Strategy: The robot must execute a strategy that includes the following elements: Opening initial orders. Placing pending
I have a robot set up that sends trading signals to my telegram group and the group sends trading signals for (28 forex pairs, 3 crypto pairs, 6 commodities, 6 indexes, & 55 stocks) basically almot 100 CFDs and sends out trend price action breakout, impulse, reversal, and exit indications to each one of those CFDs on different timeframes. I want to make it so that a person can sign up and choose which alerts they
I want to build a Trade Manager Panel Trade Manager Panel Requirements for MT4 1. Overview: The trade manager panel for MT4 is designed to provide me with efficient management of trades on individual charts/symbols. It consists of two main parts: Displaying information on currently running orders. Providing functionalities for setting and activating stop loss (SL), take profit (TP), and break-even (BE) levels

Project information

Budget
40+ USD
For the developer
36 USD
Deadline
to 10 day(s)