problem with Big in start()

 

Hi,I'm so new to MQL4.

I wanted to test this sample code that is in toturial :

--------------------------------------------------

int Count=0;
// Global variable//-------------------------------------------------------------------
int start() // Special funct. start()
{ double Price = Bid; // Local variable
Count++;
Alert("New tick ",Count," Price = ",Price);// Alert
return; // exit start()
}
//--------------------------------------------------------------------
int init() // Special funct. init()
{ Alert ("Function init() triggered at start");// Alert
return; // Exit init()
} //--------------------------------------------------------------------
int deinit(){
Alert ("Function deinit() triggered at exit");// Alert
return; // Exit deinit()

}

----------------------------------------

but it didnt work in the start() !!! Where is the problm?!

 

It works for me. What does not work for you? How are you testing it? Explain More.

 
k1rabiei:

but it didnt work in the start() !!! Where is the problm?!

Did you copy all the code inside your existing start() function or just try and run the code as is ?

int Count=0; 
// Global variable

int start()     // Special funct. start() 

   { 
   double Price = Bid; // Local variable 
   Count++; 
   Alert("New tick ",Count," Price = ",Price);// Alert 
   return; // exit start() 
   }



int init() // Special funct. init() 
   { 
   Alert ("Function init() triggered at start");// Alert 
   return; // Exit init() 
   } 

int deinit()
   {
   Alert ("Function deinit() triggered at exit");// Alert 
   return; // Exit deinit() 
   }

----------------------------------------
 
k1rabiei:
but it didnt work in the start() !!! Where is the problm?!
  1. There are no mind readers here! What didn't work? Did you compile it and place it on a chart? Did you get a smiley face? What did the journal say? Was the market open or were you using the tester in visual mode?
 

it worked only in two functions (init and deinit) .

I think it should work also in start() after incoming any ticks ! but after dragging that into the chart, in the alert box there are just alert from init() and after removing I also see deinit()'s process !

int init() // Special funct. init() 
   { 
   Alert ("Function init() triggered at start");// Alert 
   return; // Exit init() 
   } 

int deinit()
   {
   Alert ("Function deinit() triggered at exit");// Alert 
   return; // Exit deinit() 
   }
 
 
k1rabiei:

And what does it say in the experts tab/log or the journal if you are running this in the Strategy Tester ?
 

I just attached this into the chart .




 
thanx for your question . when I tried that code on strategy tester it worked correctly.i saw the start() results in journal.but why start() results are not in the alert window when I attached the code,and I just see the init() and deinit() results.
 
WHRoeder had it. You need to "Enable Expert Advisors" from the Tools>Options>Expert Advisors Tab.
 
sound's like heaven ... thanx
Reason: