Im searching this EA

 
I need an EA that will close all open positions if a % drawdown is reached, 

the drawdown is calculated in relation to closed and floating traders

the max drawdown is 10% of the initial capital, as soon as it is reached all the trades are automatically closed and disable trading in this account for several hours

But also the EA will allow to specify precise trading hours, which will be to eliminate the night trading

This means that if a person opens a trade outside of the trading hours, he is allowed to keep his trade.

So from 07:00 GMT to 22h 

These are the requirements
 

You are posting in the forum.

You should be posting in the Freelance section.

Trading applications for MetaTrader 5 to order
Trading applications for MetaTrader 5 to order
  • 2022.12.09
  • www.mql5.com
The largest freelance service with MQL5 application developers
 
Monsieur EURUSD: I need an EA that will …

You have only four choices:

  1. Search for it (CodeBase or Market). Do you expect us to do your research for you?

  2. Beg at:

  3. MT4: Learn to code it.
    MT5: Begin learning to code it.

    If you don't learn MQL4/5, there is no common language for us to communicate. If we tell you what you need, you can't code it. If we give you the code, you don't know how to integrate it into your code.

  4. Or pay (Freelance) someone to code it. Top of every page is the link Freelance.
              Hiring to write script - General - MQL5 programming forum (2019)

We're not going to code it for you (although it could happen if you are lucky or the problem is interesting.) We are willing to help you when you post your attempt (using CODE button) and state the nature of your problem.
          No free help (2017)

 
Monsieur EURUSD:
I need an EA that will close all open positions if a % drawdown is reached, 

the drawdown is calculated in relation to closed and floating traders

the max drawdown is 10% of the initial capital, as soon as it is reached all the trades are automatically closed and disable trading in this account for several hours

But also the EA will allow to specify precise trading hours, which will be to eliminate the night trading

This means that if a person opens a trade outside of the trading hours, he is allowed to keep his trade.

So from 07:00 GMT to 22h 

These are the requirements

Something like this?


DD close:

void DDclose(){ 
   double Balance = AccountInfoDouble(ACCOUNT_BALANCE);
   double Equity = AccountInfoDouble(ACCOUNT_EQUITY);
   double DD = (Equity-Balance) / Balance;
   
   if(DD <= StoplossPercentage/100) CloseAll();
}

void CloseAll(){
   for(int i=PositionsTotal()-1; i>=0; i--){
      ulong ticket = PositionGetTicket(i);
      trade.PositionClose(ticket);
   }
}


Time filter:

input group "TIME FILTER"
input bool TimeFilter = true;
input uchar StartHour = 15;
input uchar StartMinute = 0;
input uchar StopHour = 22;
input uchar StopMinute = 0;

int TimeIsCorrect(){
   MqlDateTime structTradeTime;
   MqlDateTime structNoTrade;
   TimeCurrent(structTradeTime);
   TimeCurrent(structNoTrade);
   
   structTradeTime.hour = StartHour;
   structTradeTime.min = StartMinute;
   structNoTrade.hour = StopHour;
   structNoTrade.min = StopMinute;
   
   datetime timeAllowed = StructToTime(structTradeTime);
   datetime TimeNotAllowed = StructToTime(structNoTrade);
   
      if(!TimeFilter == true){
         return 0;
      }
      if(TimeFilter == true && 
         TimeCurrent() > timeAllowed &&
         TimeCurrent() < TimeNotAllowed){
         return 0;
      }else return 1;
}

Enjoy!