The EA stops working after sometime

 

I have made a very simple EA and it gives me notification. However, after one to two hours, it just stops and my terminal is still open. Anyone have any idea why? Other EA are also like this.


My code is as following:

//+------------------------------------------------------------------+
//|                                                   New Candle.mq4 |
//|                                                            Dunia |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Dunia"
#property link      "https://www.mql5.com"
#property version   "1.00"


//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---

//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---

if(Volume[0]==1)SendNotification("A new candle is here.");

}
//+------------------------------------------------------------------+
 
if(Volume[0]==1)SendNotification("A new candle is here.");
  1. Why did you post your MT4 question in the Root / MT5 EA section instead of the MQL4 section (bottom of the Root page?) General rules and best pratices of the Forum. - General - MQL5 programming forum
  2. Bars is unreliable (a refresh/reconnect can change number of bars on chart,) volume is unreliable (miss ticks,) Price is unreliable (duplicate prices and The == operand. - MQL4 forum.) Always use time. New candle - MQL4 forum I disagree with making a new bar function, because it can only be called once per tick. A variable can be tested multiple times.
 
whroeder1:
  1. Why did you post your MT4 question in the Root / MT5 EA section instead of the MQL4 section (bottom of the Root page?) General rules and best pratices of the Forum. - General - MQL5 programming forum
  2. Bars is unreliable (a refresh/reconnect can change number of bars on chart,) volume is unreliable (miss ticks,) Price is unreliable (duplicate prices and The == operand. - MQL4 forum.) Always use time. New candle - MQL4 forum I disagree with making a new bar function, because it can only be called once per tick. A variable can be tested multiple times.


Oh, I will pay attention next time.


Thanks for the heads up.

Reason: