Download MetaTrader 5
To add comments, please log in or register
They are making profit already using Freelance service. You can join them!
orangutangas1
54
orangutangas1 2014.01.15 20:08 

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
17994
Simon Gniadkowski 2014.01.15 20:20  
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 2014.01.16 11:58  
Of course i did
Simon Gniadkowski
Moderator
17994
Simon Gniadkowski 2014.01.16 13:20  
orangutangas1:
Of course i did
So you have a smiling face in the top right corner of your chart ?
Alain Verleyen
Moderator
30295
Alain Verleyen 2014.01.16 17:59  
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
30295
Alain Verleyen 2014.01.16 18:00  
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 2014.01.16 20:32  

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