I use H4 OPEN price in my EA. I don't want to check every tick and only to check every beginning of 4 hours. How to do that?

 
I use H4 OPEN price in my EA. I don't want to check every tick and only to check every beginning of 4 hours. How to do that?
 

if(Volume[0] == 1)

{

... do your stuff...

}

.

When that is true, you are at the first tick of a new bar, in the chart timeframe.

 
int prevtime = 0;
 
int start()
{
  if(prevtime == Time[0]) return(0);
  prevtime = Time[0];
 
  // your code here
}
Try above code
 
riyo:
Try above code

Thanks riyo! I've tried and it worked.

 
phy wrote >>

if(Volume[0] == 1)

{

... do your stuff...

}

.

When that is true, you are at the first tick of a new bar, in the chart timeframe.

Thanks phy! I searched the documentation and knew what Volume[0] meant. However, I have a question, waht if the volume of first tick doesn't equal to 1?

 

Then say "I don't like this method at all", and use a Time method, or use both.

 
valleyfir:

Thanks phy! I searched the documentation and knew what Volume[0] meant. However, I have a question, waht if the volume of first tick doesn't equal to 1?

The value of Volume[0] is not a real volume but always a count for ticks in this period. So if Volume[0] == 5 itmenas the 5th tic in actual period. So what do you

mean with " .. the volume of first tick doesn't equal to 1? .."

 
JStein:

The value of Volume[0] is not a real volume but always a count for ticks in this period. So if Volume[0] == 5 itmenas the 5th tic in actual period. So what do you

mean with " .. the volume of first tick doesn't equal to 1? .."

I have thought the Volume is the actual volume, so I have a question of that. Know I understand, thanks.