MQL4 - automated forex trading   /  

Forum

function calling problem

Back to topics list To post a new topic, please log in or register

avatar
7
mkowal 2006.06.01 16:20 
Hi,
I have written an EA which consists of several function. The structure looks like:


...
init()
{}
deinit()
{}

start()
{
int x;
double y;

...
x=function1();
y=function2();
...
return(0);
}

int function1()
{
...
}

double function2()
{
...
}


when I try to compile it, an error occurs, saying that funcition1 and function2 are not defined....

where and how should I define them ?
does it tak any other declaration i.e. in start() section or in init() ?

btw - what shoul be entered into init() function ?
is it supposed to be always empty in EAs ?

best regards,

Marek
article

ZUP - Universal ZigZag with Pesavento Patterns. Part 2

ZUP - Universal ZigZag with Pesavento Patterns. Part 2 - Description of Embedded Tools


avatar
Moderator
5089
stringo 2006.06.01 17:06 
Take your sorce
int init()
  {
   return(0);
  }
 
int deinit()
  {
   return(0);
  }
 
int start()
  {
   int x;
   double y;
   x=function1(); 
   y=function2();
   return(0);
  }
 
int function1()
  {
   return(5);
  }
 
double function2()
  {
   return(3.14);
  }

and compile it. 0 errors, 0 warnings

IMHO You've missed right brace }

If You do not need for initialization/deinitialisation then don't use init()/deinit(). Remove they from source

Back to topics list  

To add comments, please log in or register