Expert Advisor only examine completed bars

 
Did a search @ the forum, and got this answer to the question of having my expert only view completed bars, and not the tick by tick data. Here's what i found

Hi,

I am using the Time[0] and trying to prevent code execution on the tick and only on a new bar

if ( Time[0] == MyTime )
return(0);
else
{
MyTime = Time[0];
Last_Bar = Last_Bar +1;
}


However, I cannot seem to get this to work. I'm currently doing this:
 datetime timeprev=0;

int start()
  {
   //Only check completed bars
   if (timeprev!=Time[0])
      return(0);
   else //Tried it with or without using the else, no change
      timeprev=Time[0];



The EA doesn't make any trades using this at the top. Any help? I want the expert to only examine a complete bar and run code on it.

 
I guess you want to say

if (timeprev==Time[0]) return (0);

(you want to return if you have seen this time already, not the other way round.).

Also, my method (taken from the MT samples) is the following:

if (Volume[0]>1) return (0);
// from here on look at indicators with index 1, e.g. iMA(NULL, 0, ...., 1);



Markus
Reason: