Download MetaTrader 5

EA does not go into start() function, please help!!

To add comments, please log in or register
orangutangas1
54
orangutangas1  

Hi,

Made an EA and was wondering why it did not work if there were no errors i the code. And found a problem. Even if i put that rookie code(bellow) i get init() alert that function initialized and that's it! I do not get any alert from start() function! How should i reach that code in start function? When i remove EA from window i get that alert that denit() function triggered. So problem is with that code in start() function. Anybody knows why i can't reach it? Tried in M1,M5 charts, tried reload metatrader and nothing...


//--------------------------------------------------------------------
// simple.mq4
// To be used as an example in MQL4 book.
//--------------------------------------------------------------------
int Count=0;                                    // Global variable
//--------------------------------------------------------------------
int init()                                      // Spec. funct. init()
   {
   Alert ("Function init() triggered at start");// Alert
   return;                                      // Exit init()
   }
//--------------------------------------------------------------------
int start()                                     // Spec. funct. start()
   {
   double Price = Bid;                          // Local variable
   Count++;                                     // Tick counter
   Alert("New tick ",Count,"   Price = ",Price);// Alert
   return;                                      // Exit start()
   }
//--------------------------------------------------------------------
int deinit()                                    // Spec. funct. deinit()
   {
   Alert ("Function deinit() triggered at deinitialization");   // Alert
   return;                                      // Exit deinit()
   }
//--------------------------------------------------------------
Simon Gniadkowski
Moderator
18056
Simon Gniadkowski  
orangutangas1:

Hi,

Made an EA and was wondering why it did not work if there were no errors i the code. And found a problem. Even if i put that rookie code(bellow) i get init() alert that function initialized and that's it! I do not get any alert from start() function! How should i reach that code in start function? When i remove EA from window i get that alert that denit() function triggered. So problem is with that code in start() function. Anybody knows why i can't reach it? Tried in M1,M5 charts, tried reload metatrader and nothing...

Did you start EAs ?

orangutangas1
54
orangutangas1  
Of course i did
Simon Gniadkowski
Moderator
18056
Simon Gniadkowski  
orangutangas1:
Of course i did
So you have a smiling face in the top right corner of your chart ?
Alain Verleyen
Moderator
35056
Alain Verleyen  
orangutangas1:

Hi,

Made an EA and was wondering why it did not work if there were no errors i the code. And found a problem. Even if i put that rookie code(bellow) i get init() alert that function initialized and that's it! I do not get any alert from start() function! How should i reach that code in start function? When i remove EA from window i get that alert that denit() function triggered. So problem is with that code in start() function. Anybody knows why i can't reach it? Tried in M1,M5 charts, tried reload metatrader and nothing...



Where is saved this EA ?

Which MT4 build are you using ?

Alain Verleyen
Moderator
35056
Alain Verleyen  
RaptorUK:
So you have a smiling face in the top right corner of your chart ?

The smiling face isn't needed for the posted code to run, it's only needed to trade.
orangutangas1
54
orangutangas1  

Hi,

Once again. Mystery solved somehow. Have no idea how. Restarted just my pc and that's it, it started working...

Ty guys!

To add comments, please log in or register