Simple question of determining the time of day

 

Hi, I need to be able to filter the time of day in my EA. Specifically if it's 7am-11am on my pc, then then execute a certain part of the code. If it's any other time use the other part of the code.

Using an if statement is fine, I read through the time functions in metatrader, from what I can tell they all return the time in the amount of seconds passed since Jan. 1 1970.

I'm not sure what I'm missing here, but how can you manipulate the time to trade certain parts of the code during the same time period every day.

Any help is appreciated!!! Look forward to spending some time in these forums as it seems to be the most active one I have found regarding MT4.

 

Will this help?

if((TimeHour(Time[0])>=(EntryHourA) && TimeMinute(Time[0])==TimeAMin) &&

(TimeHour(Time[0])<=(EntryHourB) && TimeMinute(Time[0])==TimeBMin))

{

Buy...

Sell...

}

 

Thx!

Yes it did help, I haven't used any time functions in my ea's until I found the need to today. I was unaware of the TimeHour() function, and it's really all I need to continue on. Thanks for your time, it did help me out.