Modify MT5 ontester function to omit duplicate result values

MQL5 指标 专家

工作已完成

执行时间5 天
客户反馈
Impossible project, my mistake due to limitations of mql5 ontester function. Despite this Saad put many hours into this project. A* would always recommend.
员工反馈
Great collaborating with you once more!

指定

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

反馈

1
开发者 1
等级
(281)
项目
352
29%
仲裁
37
27% / 65%
逾期
10
3%
已载入
2
开发者 2
等级
(161)
项目
208
61%
仲裁
10
80% / 0%
逾期
0
空闲
发布者: 1 代码
3
开发者 3
等级
(170)
项目
203
47%
仲裁
5
20% / 60%
逾期
3
1%
空闲
4
开发者 4
等级
(4)
项目
6
0%
仲裁
5
0% / 80%
逾期
2
33%
空闲
5
开发者 5
等级
(298)
项目
478
40%
仲裁
105
40% / 24%
逾期
82
17%
已载入
发布者: 2 代码
6
开发者 6
等级
项目
0
0%
仲裁
0
逾期
0
空闲
相似订单
Code the indicator to MT5 EA, include all the inputs variables and values Allow live trading Allow demo trading Allow strategy tester Bar shift 0 adjustable Allow indicator to show on strategy tester Lot size adjustable Max spread in points (0=disable) Use stop loss circle true or false Stop loss circle in points adjustable Use stop loss true or false Stop loss in points (adjustable) Take profit true or false Use
Hi All, Looking for a ready to TEST and USE EA which makes $20 per day with initial deposit of $100 only with controlled drawdown and no trades during news time. Please note: Budget is fixed and no trial and hit error for testing and developing EA as I do not have time. I will select the developer only after the TEST is successful only, do not force to select and make the payment and payment will be done once I am
Create a bot that can trade and read indicators easy to read for first time users. Bot that can be used on a phone and connect to MT5. It should be easy to install or use on any device especially phone and laptop, preferably the bot that can run over night and controllable when needed
Need Grid + Martingale Type Averaging EA ( Directional Buy or Sell entry then uses grid/martingale for Recovery if need ) * Must Work Buy + Sell Both Side ( Do not Open Buy or Sell at Once Let the Previous Order Close ) * Min Lot size 0.01 * Max Lot Size 1 ( Can be Edited to maximum ) * Auto TP Shift * Auto Averaging Position also Auto Shift TP as per Averaging * After Averaging Close the Trade in Maximum Profit (
C'est un Expert Advisor (EA) MQL5 pour MetaTrader 5, conçu pour l' XAUUSD , combinant un filtre de tendance et une grille adaptative avec gestion de panier ("basket") et protections contre le drawdown. Version 1.00. Logique de trading Filtre de tendance (H4 par défaut) • EMA rapide (50) vs EMA lente (200) pour déterminer la direction (UP/DOWN) • Filtre ADX (période 14, seuil 18) pour éviter de trader en
I have 2 trading view indicators by GainzAlgo that I want code to mt5 , could u advise? I need you to give me response if you can convert This
Looking for an MT4/MT5 independent risk-management service or system that can monitor and automatically close trades opened and managed by another trader’s EA. The existing EA continuously removes/overrides manually added Stop Losses and may also override SLs placed by another EA. I need a solution that does not rely on modifying the existing trade or placing a Stop Loss. Instead, it should independently monitor each
I currently sell a white-label XAUUSD EA, but the existing supplier owns the source code. I now need a new, independently developed EA and licensing system that my company fully owns and controls. I am not requesting decompilation or copying of proprietary code. Existing settings, presets and trading examples will be provided as reference. The developer must first identify any missing strategy rules before
I am looking for an experienced trader, preferably a manual trader, with a minimum 12-month verifiable live trading track record. Requirements: - Target: Up to 10% monthly return - Maximum risk/drawdown tolerance: 20% - Maximum trade duration: 5 hours - No Martingale - No Hedging - No grid or other high-risk strategies - Minimum 12 months continuous track record - Track record must be independently verifiable through
Hello! I'm looking for an experienced programmer to help me fix bugs in NEOLOGICA, PROFIT. The code is written, without errors or warnings, but not everything works correctly. Please help me. I'm looking for a programmer for a long-term collaboration, so that this project can open doors to other interesting projects. :) You need to have access to this platform, but I think that's obvious

项目信息

预算
40+ USD
截止日期
 10 天