Is there a way or event to know from in an EA that you are on a new bar.

 
I want the EA to wake up and react when the chart has moved to a new bar.
No reason to run all of this code in circles for ever waiting for a bar close and then run the logic to make EA type of decisions.
 
chart11610 wrote:
I want the EA to wake up and react when the chart has moved to a new bar.
No reason to run all of this code in circles for ever waiting for a bar close and then run the logic to make EA type of decisions.

here's how i'd do that:

int start()
{
    static datetime lastProcessedBarTime = 0;
 
    if( Time[ 0 ] == lastProcessedBarTime ) return( 0 );
    lastProcessedBarTime = Time[ 0 ];
 
    // The following EA code will only run once for every new bar
    ...
}
Reason: