How to make my EA dose not open deals at a specific times (MQL5 code)

 

I want the MQL5 code that making my EA dose not open deals at a specific times


ex:

do not open deals from 03:00 to 04:30 and from 11:00 to13:30

 
Ahmed Abd El Aziz: I want the MQL5 code that making my EA dose not open deals at a specific times ex: do not open deals from 03:00 to 04:30 and from 11:00 to13:30
Place a job request in the Freelance section or search the CodeBase.
 
Ahmed Abd El Aziz:

I want the MQL5 code that making my EA dose not open deals at a specific times


ex:

do not open deals from 03:00 to 04:30 and from 11:00 to13:30

input string   group6 = "Time Filters";//------------------------------------------------
input bool timefilter   = false; //Time Filter Activation
input string TimeStart1 = "08:00";
input string TimeEnd1 = "12:00";
input string TimeStart2 = "16:00";
input string TimeEnd2 = "20:00";
input string TimeStart3 = "01:00";
input string TimeEnd3 = "04:00";
bool tradingallowed = false;
void OnTick()
{
   Sleep(2000);
   string CurrentTime = TimeToString(TimeCurrent(),TIME_MINUTES);
   
   if(timefilter)
   {
      if(StringSubstr(CurrentTime,0,5)==TimeStart1 ||
         StringSubstr(CurrentTime,0,5)==TimeStart2 ||
         StringSubstr(CurrentTime,0,5)==TimeStart3)
         tradingallowed = true;
         
      if(StringSubstr(CurrentTime,0,5)==TimeEnd1 ||
         StringSubstr(CurrentTime,0,5)==TimeEnd2 ||
         StringSubstr(CurrentTime,0,5)==TimeEnd3)
         tradingallowed = false;
   }else
      tradingallowed = true;
}

Copied from Mehmet Ozen

 
Mohsen Bjp:

Copied from Mehmet Ozen

You are AWESOME. Thanks

Reason: