Download MetaTrader 5
To add comments, please log in or register
Trade like successful traders - subscribe to their signals!
Sherif Hasan
7223
Sherif Hasan 2014.09.25 13:14 

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
1401
SYED NAUFAL GADDAFI 2014.09.25 14:04  
There are many ways to achieve it. What is your solution or attempt ?
Sherif Hasan
7223
Sherif Hasan 2014.09.25 14:48  
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
1401
SYED NAUFAL GADDAFI 2014.09.25 17:55  

https://docs.mql4.com/dateandtime

if(TimeHour(TimeLocal())>10) && TimeMinute(TimeLocal())>10){ do this }
Something like that.
/
To add comments, please log in or register