Download MetaTrader 5

How to execute trade at the :00 minute of every hour?

To add comments, please log in or register
Chee Chua
660
Chee Chua  

How to execute trade at the :00 minute of every hour?

i.e. 1:00pm, 2:00pm, 3:00pm

when conditions are met.

Roberto Jacobs
48879
Roberto Jacobs  
jon:

How to execute trade at the :00 minute of every hour?

i.e. 1:00pm, 2:00pm, 3:00pm

when conditions are met.

in MT4:
if(Minute()==0)
//---

in MT5
MqlDateTime mqltime;
TimeToStruct(TimeCurrent(),mqltime);
if(mqltime.min==0)
whroeder1
16572
whroeder1  
in MT4:
if(Minute()==0)

The problem is this fails if there is no tick in the first minute. See "Free-of-Holes" Charts - MQL4 Articles

static int minuteCur=60; int minutePre = minuteCur;
minuteCur = Minute();   bool isTopOfTheHour = minuteCur < minutePre;
if(isTopOfTheHour) ...
Dua Yong Rew
5536
Dua Yong Rew  
Look for newbar code. Use a bool to control it.
whroeder1
16572
whroeder1  
Dua Yong Rew: Look for newbar code. Use a bool to control it.
Valid only on H1 bars.. Never stated by OP.
To add comments, please log in or register