Edit EA

To add comments, please log in or register
JONI Spd
521
JONI Spd  
Is there anyone here who has an EA type mq4, which has a timing setting. I want my EA to open positions at certain times, but have no timing setting. I want to ask for help from those of you who have an EA type mq4, just copy the timing settings, I'll insert them into my EA. Thank you for the help. ***
Faeze Bakhshayesh
4028
Faeze Bakhshayesh  
JONI Spd:
Is there anyone here who has an EA type mq4, which has a timing setting. I want my EA to open positions at certain times, but have no timing setting. I want to ask for help from those of you who have an EA type mq4, just copy the timing settings, I'll insert them into my EA. Thank you for the help. ***


bool IsTimeOK = false;
if ( StartH > EndH ) 
  {
     if ( Hour() >= StartH || Hour() < EndH ) IsTimeOK = True;
  } 
 else 
  { 
     if ( Hour() >= StartH && Hour() < EndH ) IsTimeOK = True;
  }

if (IsTimeOK )
 {
   // you can trade here
 }
William Roeder
23266
William Roeder  
  1. JONI Spd I want my EA to open positions at certain times, but have no timing setting. I want to ask for help …

    Help you with what? You haven't stated a problem, you stated a want. Show us your attempt (using the CODE button) and state the nature of your problem.
              No free help 2017.04.21

    Or pay someone. Top of every page is the link Freelance.
              Hiring to write script - General - MQL5 programming forum 2018.05.12

  2. #define HR0900 32400
    #define HR2030 73800 // (20*60+30)*30
       datetime now = time();
    bool isTimeOk = HR0900 <= now && now < HR2030;
              Find bar of the same time one day ago - MQL4 programming forum 2017.10.06

    Variations on a theme.

Rene Fernando Tovar Macchi
165
Rene Fernando Tovar Macchi  
JONI Spd:
Is there anyone here who has an EA type mq4, which has a timing setting. I want my EA to open positions at certain times, but have no timing setting. I want to ask for help from those of you who have an EA type mq4, just copy the timing settings, I'll insert them into my EA. Thank you for the help. ***

Hi JONI Spd, my five cents for MT4 would be to suggest you add this line in the ON INIT section of your EA:

EventSetTimer(60); // if you want to check every 60 seconds

Then add the below section, and code inside whatever you want to do every 60 seconds, or the frequency you setup above:

void OnTimer()

  {

  }


Keith Watford
Moderator
25599
Keith Watford  
Rene Fernando Tovar Macchi:

Hi JONI Spd, my five cents for MT4 would be to suggest you add this line in the ON INIT section of your EA:

EventSetTimer(60); // if you want to check every 60 seconds

Then add the below section, and code inside whatever you want to do every 60 seconds, or the frequency you setup above:

void OnTimer()

  {

  }


It seems that the OP wants to trade only at certain times of the day.

IF that is so, how will using the timer help?

Rene Fernando Tovar Macchi
165
Rene Fernando Tovar Macchi  
Keith Watford:

It seems that the OP wants to trade only at certain times of the day.

IF that is so, how will using the timer help?

Hi Keith, I see your point, actually Faeze Bakhshavesh showed the coding to check for "certain time of the day".  No worries.

To add comments, please log in or register