Market Validation Problems

 

Anybody had problems validating their EA, service desk says its a time out... but I have a bigger slower EA that validated fine...

Unless these are recent changes?


This is the error i get: 

test on EURUSD,H1 (netting) there are no trading operations test on XAUUSD,D1 (netting) there are no trading operations test on GBPUSD,M30 (netting) there are no trading operations test on EURUSD,M1 (netting) there are no trading operations

Validation state: Validation completed with errors

  • Errors count 1
  • Started 2023.04.18 20:23:30
  • Finished 2023.04.18 20:59:40
  • Type Expert Advisor

I was told to read this but nothing in here has a solution as i have used it for my Traders Toolbox EA to make sure it passes tests in the past...

The checks a trading robot must pass before publication in the Market

Any Ideas?

The checks a trading robot must pass before publication in the Market
The checks a trading robot must pass before publication in the Market
  • www.mql5.com
Before any product is published in the Market, it must undergo compulsory preliminary checks in order to ensure a uniform quality standard. This article considers the most frequent errors made by developers in their technical indicators and trading robots. An also shows how to self-test a product before sending it to the Market.
 

Given that it is a Market product and you can't show your code, I doubt you will be able to get any satisfactory answer.

However, I will ask this ... is your EA for "hedging" account, "netting" account or both?

If it is only for "hedging" accounts, did you correctly identify that in the Market product classification so that it does not carry out "netting" tests?

If it is for "netting" account or both, have you tested it yourself on "netting" accounts?
 
Fernando Carreiro #:

Given that it is a Market product and you cant show your code, I doubt you will be able to get any satisfactory answer.

However, I will ask this ... is your EA for "hedging" account, "netting" account or both?

If it is only for "hedging" accounts, did you correctly identify that in the Market product classification so that it does not carry out "netting" tests?

If it is for "netting" account or both, have you tested it yourself on "netting" accounts?
Well I believe it should work on either, however the EA is already in the store but the update is not passing which was just strategy adjustments nothing to do with hedging or netting transactions ? 
 
Jason Kisogloo #Well I believe it should work on either, however the EA is already in the store but the update is not passing which was just strategy adjustments nothing to do with hedging or netting transactions ? 

"Belief" has no place in the world of programming. It is or it is not!

So, I will ask again, irrespective of what changes you made, have you tested it yourself on both "netting" and "hedging" accounts?

Do your tests work correctly in both cases?

What did you state in your product's description properties—did you select "hedging", "netting" or both?

 
Fernando Carreiro #:

"Belief" has no place in the world of programming. It is or it is not!

So, I will ask again, irrespective of what changes you made, have you tested it yourself on both "netting" and "hedging" accounts?

Do your tests work correctly in both cases?

What did you state in your product's description properties—did you select "hedging", "netting" or both?

I have many brokers and cant find a netting account to test on… its seems most accounts are hedging? Any ideas where i can open a deno netting account? 
 
Jason Kisogloo #: I have many brokers and cant find a netting account to test on… its seems most accounts are hedging? Any ideas where i can open a deno netting account? 

Create one! Create a "demo" account and select non-hedging. Almost all brokers I know allow the creation of "netting" accounts for MT5.

If you have never tested your EA under "netting" conditions, then don't classify it has being able to trade on "netting", and also don't be surprised if the validation fails for "netting".

Do your due diligence. Either classify it as "Hedging only" or do the proper testing and validations.

 

 
Fernando Carreiro #:

Create one! Create a "demo" account and select non-hedging. Almost all brokers I know allow the creation of "netting" accounts for MT5.

If you have never tested your EA under "netting" conditions, then don't classify it has being able to trade on "netting", and also don't be surprised if the validation fails for "netting".

Do your due diligence. Either classify it as "Hedging only" or do the proper testing and validations.

 

Thanks didn't know i could do this with MetaQuotes demo... so far working perfectly on netting account? So still not sure why validator is failing...

 
Jason Kisogloo #: Thanks didn't know i could do this with MetaQuotes demo... so far working perfectly on netting account? So still not sure why validator is failing...

How can you state it works "perfectly on netting account", when you have just confessed never having used or tested on a netting account?

 
Jason Kisogloo #: Thanks didn't know i could do this with MetaQuotes demo... so far working perfectly on netting account? So still not sure why validator is failing...

By the way, make a backup of everything before connecting to e MetaQuotes demo trading server as it will push out "beta" builds of MetaTrader.

You will need to restore afterwards.

Its best to use a broker netting account.

 
Fernando Carreiro #:

How can you state it works "perfectly on netting account", when you have just confessed never having used or tested on a netting account?

Well its trading as usual the only difference is only one position on asset as a time which is not a problem... (thats what i understood the only difference is?)


It works as it was designed... is it optimised? maybe not.... but it works... what can i say ;)

 

Hello Dear Friends, I have managed to pass the MQL5 Market Validation for my MT4 TEST EA, it has overcome multiple errors like proper order send, proper order close, invalid volume checks error 131 and insufficient funds, EA code is attached here for you reference, thanks.

//+------------------------------------------------------------------+
//|                                     MQL5AutoValidationPassEA.mq4 |
//|                                Copyright 2024, FxProfitBots ltd. |
//|                                                 fxprofitbots.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2024, FxProfitBots ltd."
#property link      "fxprofitbots.com"
#property version   "1.00"
#property strict


// Input parameters
input double Lots = 0.1;
input int StopLoss = 100;
input int TakeProfit = 100;

#define MAGIC_NUMBER 123456

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
{
    Print("SimpleEA initialized.");
    return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
    Print("SimpleEA deinitialized.");
}
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
{
    if (OrdersTotal() == 0)  // Check if there are no open orders
    {
        if (ShouldOpenTrade())
        {
            double volume = NormalizeLotSize(Lots);
            if (volume > 0 && CheckMoneyForTrade(Symbol(), volume, OP_BUY))
            {
                OpenBuyTrade(volume);
            }
        }
    }
}

//+------------------------------------------------------------------+
//| Function to open a buy trade                                     |
//+------------------------------------------------------------------+
void OpenBuyTrade(double volume)
{
    double price = Ask;
    double sl = price - StopLoss * Point;
    double tp = price + TakeProfit * Point;

    int ticket = OrderSend(Symbol(), OP_BUY, volume, price, 3, sl, tp, "SimpleEA Buy", MAGIC_NUMBER, 0, Blue);
    if (ticket < 0)
    {
        Print("OrderSend failed with error #", GetLastError());
    }
    else
    {
        Print("Buy order opened successfully. Ticket: ", ticket);
    }
}

//+------------------------------------------------------------------+
//| Function to close all trades                                     |
//+------------------------------------------------------------------+
void CloseAllTrades()
{
    for (int i = OrdersTotal() - 1; i >= 0; i--)
    {
        if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
        {
            if (OrderType() == OP_BUY || OrderType() == OP_SELL)
            {
                bool result = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 3, clrRed);
                if (!result)
                {
                    Print("OrderClose failed with error #", GetLastError());
                }
                else
                {
                    Print("Order closed successfully. Ticket: ", OrderTicket());
                }
            }
        }
    }
}

//+------------------------------------------------------------------+
//| Function to check if trade should be opened                      |
//+------------------------------------------------------------------+
bool ShouldOpenTrade()
{
    // Example condition: simple moving average crossover
    int maPeriod = 14;
    double maCurrent = iMA(Symbol(), 0, maPeriod, 0, MODE_SMA, PRICE_CLOSE, 0);
    double maPrevious = iMA(Symbol(), 0, maPeriod, 0, MODE_SMA, PRICE_CLOSE, 1);

    return (maCurrent > maPrevious);
}

//+------------------------------------------------------------------+
//| Function to normalize the lot size according to market conditions|
//+------------------------------------------------------------------+
double NormalizeLotSize(double lotSize)
{
    double minLot = MarketInfo(Symbol(), MODE_MINLOT);
    double maxLot = MarketInfo(Symbol(), MODE_MAXLOT);
    double lotStep = MarketInfo(Symbol(), MODE_LOTSTEP);

    if (lotSize < minLot) lotSize = minLot;
    if (lotSize > maxLot) lotSize = maxLot;
    lotSize = MathFloor(lotSize / lotStep) * lotStep;

    if (lotSize < minLot || lotSize > maxLot)
    {
        Print("Lot size out of range. Adjusted to ", lotSize);
        return 0;
    }

    return lotSize;
}

//+------------------------------------------------------------------+
//| Function to check if there is enough money for trade             |
//+------------------------------------------------------------------+
bool CheckMoneyForTrade(string symb, double lots, int type)
{
    double free_margin = AccountFreeMarginCheck(symb, type, lots);
    //-- if there is not enough money
    if (free_margin < 0)
    {
        string oper = (type == OP_BUY) ? "Buy" : "Sell";
        Print("Not enough money for ", oper, " ", lots, " ", symb, " Error code=", GetLastError());
        return false;
    }
    //--- checking successful
    return true;
}