How would a write a program to simply alert me when a new bar appears?

 
renner1984 wrote >>

Pointless as it is, how would I write a program alerting me when the next bar appears? I ask so I can get the values of a moving average when a bar closes and a new one opens. Thanks.

//+------------------------------------------------------------------+
//| EA.mq4 |
//| Copyright © 2009, EADeveloper |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, EADeveloper"
#property link ""

static int prevtime = 0;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----

if (Time[0] == prevtime) return(0);
prevtime = Time[0];
Alert("New Bar!");

//----
return(0);
}
//+------------------------------------------------------------------+

:-)