Help to correct the source code by trading 2 different time session

 
extern string  BrokerTime  =   "First Session";
extern string  StartTime   ="00:00:00";
extern string  EndTime     ="14:00:00";
extern string  BrokerTime_ =   "Second Session";
extern string  StartTime1  ="19:00:00";
extern string  EndTime1    ="23:55:00";

void start()
  {
if(StrToTime(StartTime)<TimeCurrent() && StrToTime(EndTime)+5>TimeCurrent()|| StrToTime(StartTime1)<TimeCurrent() && StrToTime(EndTime1)+5>TimeCurrent() )
  }
 

Please edit your post and

use the code button (Alt+S) when pasting code


I strongly advise you to never use StrToTime or StringToTime without an actual date in the string. This is because it will return the computer's local date, not necessarily the same as the platform date, which may not work with the code.

StrToTime(EndTime)+5

Why do you add the 5?

You may find it easier to have a start hour and start minute and then check Hour() and Minute() against these.

 

Never mix ands and ors with out parentheses. which do you mean?

(StartTime<now &&  EndTime+5>now )||(StartTime1<now && EndTime1+5>now)
 StartTime<now && (EndTime+5>now || StartTime1<now) && EndTime1+5>now
 
William Roeder:

Never mix ands and ors with out parentheses. which do you mean?

Keith Watford:

Please edit your post and

use the code button (Alt+S) when pasting code


I strongly advise you to never use StrToTime or StringToTime without an actual date in the string. This is because it will return the computer's local date, not necessarily the same as the platform date, which may not work with the code.

Why do you add the 5?

You may find it easier to have a start hour and start minute and then check Hour() and Minute() against these.

I still can not get it right 

 
William Roeder:

Never mix ands and ors with out parentheses. which do you mean?

Which is the correct way ?

Reason: