Download MetaTrader 5

Current time frame check OnTick olny once

To add comments, please log in or register
Have you discovered something really important? Write an article and receive 200 USD!
GoodPointMas
108
GoodPointMas 2015.01.21 20:29 

let's say I'm after time frame H1, EA runs on OnTick even, how to say -> new bar is ready - check the conditions once - run logic to open/close  order

but check only once and wait next H1, not check every Tick during this H1 and run logic

may be I need to use onTime but not sure how 

honest_knave
Moderator
2192
honest_knave 2015.01.21 21:19  
static datetime LastHr=0;
datetime ThisHr=iTime(NULL,PERIOD_H1,0);
if(LastHr!=ThisHr)
   {
    // do what you want to do once per hour in here
   LastHr=ThisHr;
   }
To add comments, please log in or register