That was nice of you, Lux.
I found this:
Only process each bar once - MQL4 forum
Automated 2008.01.15 18:54 You could execute your code at the very first tick of a new bar ( i.e. right after the previous bar has closed ).
Here's a function that will return TRUE if a new bar has just formed:
// This function returns TRUE at the very first tick a bar i.e. after the previous bar has just closed
bool NewBar()
{
if(PreviousBarTime<Time[0])
{
PreviousBarTime = Time[0];
return(true);
}
return(false); // in case if - else statement is not executed
} you need to declare datetime PreviousBarTime at the beginning of your EA...
then in your code you could just use
if ( NewBar() )
{
...... code you need to be executed after a bar has closed here ....
} thank you
automatedfx@gmail.com
---------------------------------------------------
I noticed you used STATIC... I looked it up... what's the advantage of using STATIC vs a global variable?