Strange Error "Testing pass stopped due to a critical error in the EA"

To add comments, please log in or register
Ahmed Tawfik
359
Ahmed Tawfik  
double p2p;
  
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
 if(Digits==3 || Digits==5) p2p=10;else p2p=1;    
 
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---

   int m0=Minute(); // Current Hour
   int s0=Seconds(); // Current Sec
   int t0=(m0*60)+s0;

   double candle0=(High[0]-Low[0])*p2p;
   double velocity0=candle0/t0;// this is the Line which makes the Propblem !!!!!!!!!!!!!!!!
   }
//+------------------------------------------------------------------+

Hello Every One

I am Trying to Test the pips moved Per Sec in a single Bar , and when it is attached to the Chart It Works Fine , however when i Try to back test it gives Strange Error , Any help ???

Error

2019.08.14 12:19:48.792 2019.07.01 00:00:00  Testing pass stopped due to a critical error in the EA


William Roeder
19628
William Roeder  
  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
    Next time post in the correct place. The moderators will likely move this thread there soon.

  2. Obviously you have a divide by zero. At the top of every hour, minutes and seconds are zero, therefor t0 is zero.


To add comments, please log in or register