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);
}
//+------------------------------------------------------------------+
:-)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
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.