Time filter hours and minutes

To add comments, please log in or register
Ma- -Hi
221
Ma- -Hi  
Hello everybody,

I have the following time filter in an EA:
extern string StartHour1 = "9";
extern string EndHour1 = "21";

int CurrentTime;

bool TradingTime()
{
CurrentTime = TimeHour(TimeCurrent());
if (StartHour1 < EndHour1)
{
if ((CurrentTime < StartHour1) || (CurrentTime >= EndHour1)) return(false);
}
if (StartHour1 > EndHour1)
{
if ((CurrentTime < StartHour1) && (CurrentTime >= EndHour1)) return(false);
}
return(true);


int start()
{
if (TradingTime() == false) return(0);
At the EA input
I would like to specify however hours and minutes in a line (see as example TimeFilter-settings.JPG)
How should the code be changed?
Thanks in advance for your help.
Max
Files:
Keith Watford
Moderator
13925
Keith Watford  
extern string StartHour1 = "9";
extern string EndHour1 = "21";

These should be integers, not strings (in your current code).

To add comments, please log in or register