How to Stop EA for 1 Hour?

To add comments, please log in or register
Sherif Hasan
7283
Sherif Hasan  

Hi!,

I would like to stop my EA on News Hour. so that i want to implement to stop trading in before and after 30 news time.

Eg:

NewsHour1=15:30;
NewsHour2=11:30;

When NewsHour1 is 15:30 EA should stop from 15:00 to 16:00

When NewsHour1 is 11:30 EA should stop from 11:00 to 12:00

Please give me suggetion?

Thanks in Advance

Syed Naufal Gaddafi
1733
Syed Naufal Gaddafi  
There are many ways to achieve it. What is your solution or attempt ?
Sherif Hasan
7283
Sherif Hasan  
deysmacro:
There are many ways to achieve it. What is your solution or attempt ?

not exact ways i know:

HoursMinutesFrom2 = userinput-30min;
HoursMinutesTo2 = userinput-30min;

{
    int hour = 100 * Hour() + Minute();
    
    if ((HoursMinutesFrom < HoursMinutesTo && hour >= HoursMinutesFrom && hour < HoursMinutesTo) ||
    (HoursMinutesFrom > HoursMinutesTo && (hour < HoursMinutesTo || hour >= HoursMinutesFrom)))
    {
        
    }
Syed Naufal Gaddafi
1733
Syed Naufal Gaddafi  

https://docs.mql4.com/dateandtime

if(TimeHour(TimeLocal())>10) && TimeMinute(TimeLocal())>10){ do this }
Something like that.
Cromo
259
Cromo  

Can you tell me how to stop EA for 8 hours in MQL4?

Marco vd Heijden
Moderator
12735
Marco vd Heijden  

use

TimeHour(TimeCurrent));
To add comments, please log in or register