Modify MT5 ontester function to omit duplicate result values

MQL5 Indicadores Asesores Expertos

Trabajo finalizado

Plazo de ejecución 5 días
Comentario del 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.
Comentario del Ejecutor
Great collaborating with you once more!

Tarea técnica

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

Han respondido

1
Desarrollador 1
Evaluación
(148)
Proyectos
176
24%
Arbitraje
7
29% / 43%
Caducado
4
2%
Ocupado
2
Desarrollador 2
Evaluación
(95)
Proyectos
117
38%
Arbitraje
9
89% / 0%
Caducado
0
Trabaja
3
Desarrollador 3
Evaluación
(163)
Proyectos
193
48%
Arbitraje
2
50% / 50%
Caducado
1
1%
Libre
4
Desarrollador 4
Evaluación
(4)
Proyectos
6
0%
Arbitraje
5
0% / 80%
Caducado
2
33%
Libre
5
Desarrollador 5
Evaluación
(259)
Proyectos
420
38%
Arbitraje
86
44% / 19%
Caducado
70
17%
Ocupado
6
Desarrollador 6
Evaluación
Proyectos
0
0%
Arbitraje
0
Caducado
0
Libre
Solicitudes similares
I require a breakdown analysis of an existing EA I have been using with some success on MT4. If possible I would like a developer to breakdown the Smart Machine EA, to understand why it places trades, under what market conditions, what indicators it uses etc. With the requirement specifications from the EA, I would then like to modify it to reduce some risk, and create a new EA
Média móvel M édia móvel sugeridas 8 21 50 e 200 quero que qualquer média móvel que eu possa adicionar tenha essa função As médias apareça em uma só tela como exemplo igual o tradingview as médias sejam todas em uma tela e que apareça de qual tempo gráfico é Linhas mais finas em tempos gráficos menores e linhas mais grossas em tempos maiores Quando tocados em qualquer média móvel o px diminui, de 2px para 1 px e
Use whatever combination of indicator you want, but requirements is: Requirements: - must open a 3-4 lot XAUUSD every day (can use news filter to filter high impact days) - TP of 2.000 USD - SL of 14.000 USD Provide backtest screenshot of the last 2 years upon applying for the job
Location: Remote Employment Type:[Full-time/Part-time] About Us At Riskeys, we are transforming the trading experience with our state-of-the-art Smart Trading Keypad for MetaTrader 4/5. Our mission is to empower traders with innovative risk management tools, providing them with the speed, precision, and efficiency they need to succeed in today’s fast-paced financial markets. As we continue to push the boundaries of
I am looking for a highly skilled and experienced developer who can assist with converting six Pine Script strategies into NinjaTrader. The goal is to seamlessly transition these scripts while preserving their original functionality and ensuring they operate efficiently on the NinjaTrader platform. If you have the expertise and are interested in this project, please reach out. I am looking forward to collaborating
Bottrading 30 USD
// Khai báo các tham số đầu vào input int rsiPeriod = 14; // Chu kỳ RSI đầu vào mua gấp đôiLevel = 30,0; // Ngưỡng quá bán RSI để mua đầu vào bán gấp đôiLevel = 70,0; // Ngưỡng quá mua RSI để bán đầu vào int movingAveragePeriod = 50; // Chu kỳ trung bình để theo dõi tài khoản đầu vào rủi ro képPerTrade = 1,0; // Tỷ lệ sai sót của mỗi lệnh (% tài khoản) input int keyLevelPeriod = 100; // Chu kỳ tìm kiếm key level đầu
The Trading View Indicator script has about 80% of what I need. 1. I have an additional entry model called a confirmation entry 2. I normally just look back 3-50 bars to determine if a bar is wide range or not, but the 3 additional WRB models require requirements based on 3 bars before it, and each one has its own name. 3. The TV indicator has a lot of visual cosmetics that we won't be able to do in MT5, but colour
Modify MT4 EA 30+ USD
Hello good Day, I would like to make a modification to an mql4 robot that I have and I am sure that by doing a couple of additional things it would be perfect. looking for someone to help me with it, and make sure you understand Spanish because the Mql4 is in Spanish, I need to place a max order, a filter for operating hours, and add a counter order to the grid, that is, when opening the final order "N" of the grid
Hello good Day, I would like to make a modification to an mql4 robot that I have and I am sure that by doing a couple of additional things it would be perfect. looking for someone to help me with it, and make sure you understand Spanish because the Mql4 is in Spanish
Need to amend the following Composite Index indicator ) Double divergence scanner MT5) to ONLY produce an Alert when it follows a Awesome Oscillator (AO) zero line cross. If the AO cross is down the Composite Index (CI) Alert should only occur on Bearish Divergence signals If the AO cross is up the CI Alert should only occur on Bullish Divergence signals Need all timeframes as per existing CI Indicator. When the

Información sobre el proyecto

Presupuesto
40+ USD
Para el ejecutor
36 USD
Plazo límite de ejecución
a 10 día(s)