Discussion of article "The checks a trading robot must pass before publication in the Market" - page 21

 

There was an error in the check_freezelevel.mq5 file code (line 140) missing the `if(!TP_check)` statement

bool CheckPositionForFREEZE_LEVEL(ulong ticket)
  {
//--- get the SYMBOL_TRADE_FREEZE_LEVEL level
   int freeze_level=(int)SymbolInfoInteger(_Symbol,SYMBOL_TRADE_FREEZE_LEVEL);
   if(freeze_level!=0)
     {
      PrintFormat("SYMBOL_TRADE_FREEZE_LEVEL=%d: Cannot modify order"+
                  "  nearer than %d points from the activation price",freeze_level,freeze_level);
     }
//--- select position for working
   if(!PositionSelectByTicket(ticket))
     {
      //--- failed to select position
      return(false);
     }
//--- get the order data     
   ENUM_POSITION_TYPE pos_type=(ENUM_POSITION_TYPE)PositionGetInteger(POSITION_TYPE);
   double sl=PositionGetDouble(POSITION_SL);
   double tp=PositionGetDouble(POSITION_TP);
//--- result of checking StopLoss and TakeProfit
   bool SL_check=false,TP_check=false;
//--- position type
   switch(pos_type)
     {
      //--- buy
      case POSITION_TYPE_BUY:
        {
         SL_check=(Bid-sl>freeze_level*_Point);
         if(!SL_check)
            PrintFormat("Position %s #%d cannot be modified: Bid-StopLoss=%d points"+
                        " < SYMBOL_TRADE_FREEZE_LEVEL=%d points)",
                        EnumToString(pos_type),ticket,(int)((Bid-sl)/_Point),freeze_level);
         TP_check=(tp-Bid>freeze_level*_Point);
         if(!TP_check)
            PrintFormat("Position %s #%d cannot be modified: TakeProfit-Bid=%d points"+
                        " < SYMBOL_TRADE_FREEZE_LEVEL=%d points)",
                        EnumToString(pos_type),ticket,(int)((tp-Bid)/_Point),freeze_level);
         //--- return the result of checking
         return(SL_check&&TP_check);
        }
      break;
      //--- sell
      case POSITION_TYPE_SELL:
        {
         SL_check=(sl-Ask>freeze_level*_Point);
         if(!SL_check)
            PrintFormat("Position %s cannot be modified: StopLoss-Ask=%d points"+
                        " < SYMBOL_TRADE_FREEZE_LEVEL=%d points)",
                        EnumToString(pos_type),(int)((sl-Ask)/_Point),freeze_level);
         TP_check=(Ask-tp>freeze_level*_Point);
         PrintFormat("Position %s cannot be modified: Ask-TakeProfit=%d points"+
                     " < SYMBOL_TRADE_FREEZE_LEVEL=%d points)",
                     EnumToString(pos_type),(int)((Ask-tp)/_Point),freeze_level);
         //--- return the result of checking
         return(SL_check&&TP_check);
        }
      break;
     }
//--- position did not pass the check
   return (false);
  }
 
Hello, My EA trades based on news events and it doesn't work in the strategy tester but it is profitable in the live account. Will my EA not working in the tester make it fail the market validation
 

In general, checking the TakeProfit and StopLoss levels with the minimum distance of SYMBOL_TRADE_STOPS_LEVEL taken into account looks as follows:

  • Buying is done at the Ask price — the TakeProfit and StopLoss levels must be at the distance of at least SYMBOL_TRADE_STOPS_LEVEL points from the Bid price.
  • Selling is done at the Bid price — the TakeProfit and StopLoss levels must be at the distance of at least SYMBOL_TRADE_STOPS_LEVEL points from the Ask price.
Buying is done at the Ask price
Selling is done at the Bid price
TakeProfit - Bid >= SYMBOL_TRADE_STOPS_LEVEL
Bid - StopLoss >= SYMBOL_TRADE_STOPS_LEVEL
Ask - TakeProfit >= SYMBOL_TRADE_STOPS_LEVEL
StopLoss - Ask >= SYMBOL_TRADE_STOPS_LEVEL



Can someone please explain the doubt that I'm having?

I understand that buying is done on the ask price, and selling is done on the bid price. I also can understand why we're using bid price to compare when buying for stop loss and take profit (because we'll be taking the opposite trade, selling, thus bid price).

However, I don't understand why the take profit doesn't also get compared to the ask price when buying, because if we only compare it to the bid price, user could potentially set the value higher than the bid price but lower than the ask price, which totally doesn't make any sense?

Thanks for your time.

 

Hi,

my EA is declined because the validation reports "no trading activities". As my EA is designed to trade at a specific news date I would need to know what historical data is used during EA validation. Then I coudl provide a default date for validation purposes.

Thanks in advance

Tim

 
@Tim Arthur Herbert Kasprzyk #: my EA is declined because the validation reports "no trading activities". As my EA is designed to trade at a specific news date I would need to know what historical data is used during EA validation. Then I coudl provide a default date for validation purposes.

It seems you did not read this topic before posting ...

Forum on trading, automated trading systems and testing trading strategies

Discussion of article "The checks a trading robot must pass before publication in the Market"

Fernando Carreiro, 2022.12.24 18:46

As per the Market product rules, you are not allowed to restrict or limit your EA to a single symbol. Your EA must work for all symbols, even if its intended use is for a single symbol.

Forum on trading, automated trading systems and testing trading strategies

Discussion of article "The checks a trading robot must pass before publication in the Market"

Fernando Carreiro, 2023.03.27 01:50

You are not allowed to limit your EA in any way. It must be able to trade on anything an everything, even if it was designed for indices. Please read the Market rules.

Forum on trading, automated trading systems and testing trading strategies

Discussion of article "The checks a trading robot must pass before publication in the Market"

Fernando Carreiro, 2023.06.01 13:15

Your EA must be able to trade on all symbols and all time-frames. There must be no limitations.

To reduce your log size, consider ...

  • Reducing the number of "prints" statements to the log output
  • Using a trailing-step or time-step instead of continuous trailing stops.
  • Don't continuously create and delete pending orders. Consider using "virtual" pending orders.
 
Fernando Carreiro #:

It seems you did not read this topic before posting ...

Hi Fernando, thanks for your feedabck. Actually my EA is not restricted to any symbol, or timeframe. It only requires a specified news date like FED interest rate news date. I also provide a default news date in the EA. So in theory it should pass the validation. But it might be the case that the validation process is using historical data which is not covering my default date. THerefor it would be helpful to understand which historical data is used (not which symbol or timeframe, this I can see in the report).
 
@Tim Arthur Herbert Kasprzyk #: Hi Fernando, thanks for your feedabck. Actually my EA is not restricted to any symbol, or timeframe. It only requires a specified news date like FED interest rate news date. I also provide a default news date in the EA. So in theory it should pass the validation. But it might be the case that the validation process is using historical data which is not covering my default date. THerefor it would be helpful to understand which historical data is used (not which symbol or timeframe, this I can see in the report).

It is still a limitation. Remove any and all limitations by setting the default parameter values to allow trading irrespective of any given date, symbol, or time-frame.

The EA will also need to read the contract specifications and adjust accordingly, or else it will fail the validation process.

 
I get the message "Strategy Tester Report not found" EURUSD 1H.  How can I solve this?

I've checked many times in strategy tester and my EA works without any errors.

I coded a "Validation Test" EA that simply opens a position with minimum allowed volume and closes the position after a few seconds, but same error did happen.

 

Just read a comment  regarding validation report saying "no trading activities". Must all EAs trade? My EA is just drawing stuffs on the chart, or it should had been an Indicator?

 

Anyone with this type of problem? In the Metaquotes DEMO account it works normally and in the test it did not pass validation.


test on EURUSD,H1 (netting) 2021.06.30 23:59:59 ExpertRemove() function called removed itself within OnDeinit removed itself on 99% of testing interval strategy tester report 1 total trades