Modify MT5 ontester function to omit duplicate result values

MQL5 Indicadores Experts

Trabalho concluído

Tempo de execução 5 dias
Comentário do cliente
Impossible project, my mistake due to limitations of mql5 ontester function. Despite this Saad put many hours into this project. A* would always recommend.
Comentário do desenvolvedor
Great collaborating with you once more!

Termos de Referência

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;
}

Respondido

1
Desenvolvedor 1
Classificação
(119)
Projetos
140
23%
Arbitragem
5
0% / 60%
Expirado
4
3%
Carregado
2
Desenvolvedor 2
Classificação
(76)
Projetos
95
34%
Arbitragem
8
88% / 0%
Expirado
0
Carregado
3
Desenvolvedor 3
Classificação
(163)
Projetos
193
48%
Arbitragem
2
50% / 50%
Expirado
1
1%
Livre
4
Desenvolvedor 4
Classificação
(4)
Projetos
6
0%
Arbitragem
5
0% / 80%
Expirado
2
33%
Livre
5
Desenvolvedor 5
Classificação
(251)
Projetos
402
38%
Arbitragem
82
41% / 20%
Expirado
70
17%
Trabalhando
6
Desenvolvedor 6
Classificação
Projetos
0
0%
Arbitragem
0
Expirado
0
Livre
Pedidos semelhantes
Overview I would like a fully automated trading robot based on Traders Dynamic Index with Moving Average support for trade entry and exit. TDI indicator will be provided. This will be a trend trading system with additional Telegram support. Settings to be customisable based on below description and further information as available. System to be used for any symbol and on any time frame but focus on higher time frame
I need a developer that can turn my strategy to an EA, We will be using Fib, some indicators and a risk management settings, please message me on time so we start work on it, waiting for you
Hello Everyone, I'm looking a profitable Expert Adviser, with a very Good Past Performance. The EA must be Run on live Account for more than 5 to 6 months. The EA having a Profit ratio with a Minimum drawdown. If having Ready made or, anyone can develop new one
Necesito hacer que ese codigo trabaje en el par EURUSD y no sé en que estoy fallando. He visto foros pero no me resulta lo que hago bla bla bla bla
Job Title: Expert MQL5 Developer for MT5 EA Integration with TrendSpider and Risk Management Job Description: We are seeking an experienced MQL5 developer to complete an Expert Advisor (EA) project for MetaTrader 5 (MT5). The primary goal of this project is to integrate trading signals generated by TrendSpider into an MT5 EA, enabling automated trading based on these signals while ensuring compliance with prop firm
Hi, I have existing EAs with source code and i am looking to add some trend confirmation filter, Loss Recovery option, Trailing SL, Trading Session filters & News filter as follows : 1. 3 Filter of Moving Average multi time frame. 2. 3 Super Trend Filter multi time frame. 3. 3 Parabolic Sar filter multi time frame. 4. Trading Session Filter (Asian, London, New York) 5. High Impact New Filter 6. Trailing based on
I want a simple mt4 EA that monitors existing positions for TP and SL changes. If a new position is placed, it should automatically set the SL and TP based on the already open orders. Additionally, if I change the SL or TP of one order, it should also change the SL or TP of all the other orders accordingly. I will only be using this EA on one pair, of course
Hello I want to change my TREND indicator. The conditions for the alerts do not need to be changed, the indicator works very very well. I would like to add visible Stop and Tp level lines. Attached is the source code and text file. If you think you could do this job, let me know. Thanks in advance
hello DEVELOPERS bid this project, i need to create a MT5 expert advisor with some indicators (mt4 indicators), so we should convert mt4 indicators to mt5 and then create a new ea with my requirements, it's not urgent
Hi all, looking for somebody to build me a trading bot. Something that is good. Fairly new to trading but I know the basics and how everything runs. Due to working a 9-5 looking for a bot to help out with trades and etc

Informações sobre o projeto

Orçamento
40+ USD
Desenvolvedor
36 USD
Prazo
para 10 dias