mysterious compiler errors?

 
Hi,

I (MT4 (from Boston Cons.) build 402) have written an EA that actually trades quite ok.

Now I wanted to rewrite everything but the compiling fails with Errors that I don't understand!

First Error message that shows up several times:
')' wrong parameters count.
Each time this Error appears this message is pointing to:
return(); //right between the two paranthesis
of a void function() { .. } ???
Some of the return() aren't really needed as they are the last line of a function, but some some of them should leave their function before that last } is reached -- what to do, what is my mistake?
(I tried to change the function to a bool function returning false - no change, the same error.)

The second type of compiler error (even this appears several times) is the
 'pos' - internal error

One (e.g.) function is pretty simple:

 string pos2txt ( int pos ) {
    switch (pos) {
      case OP_BUY:       return("BUY "); //return(" BUY  ");
      case OP_SELL:      return("SELL"); //return(" SELL ");
      case OP_BUYLIMIT:  return("ByLi"); //return("BuyLim");
      case OP_SELLLIMIT: return("SeLi"); //return("SelLim");
      case OP_BUYSTOP:   return("BySt"); //return("BuyStp");
      case OP_SELLSTOP:  return("SeSt"); //return("SelStp");
    }
 }
Each time here (internal error) I have a switch(var) of a var being passed to that function.

Well, in my original first version all the equivalent codes were accepted without any problem and compiler error?

First I had my code distributed in different files to be included,
but even if I paste everything in one file I get the same errors?

Any hint what might this cause?
Thanks in advance
Gooly
 

A void function doesn't return anything . . so why the Return ? The error may be elsewhere though . . . comment out that function, or bits of it to confirm where the error lies.

I added your code to my EA and it compiles without error. You did add this function outside of init, deinit and start ?

 
RaptorUK:

A void function doesn't return anything . . so why the Return ? The error may be elsewhere though . . . comment out that function, or bits of it to confirm where the error lies.

I added your code to my EA and it compiles without error. You did add this function outside of init, deinit and start ?

1) error return();

Well I need th return() to leave the void function(). And like my other problem elsewhere I've never had this problem before, like:

if ( noPOS <= 0 ) return();

Misteriously after I replaced one of my return(); by break;

all of the second error typ disappeared?

All my funtions are defined in the 'lower body' of the EA of course not within another function.

Now only two return(); remain with which I don't know what to do?

Well of course I could write some mor code to pass that, but I should not need to do that.

 
There are 2 return operators and return() is NOT one of them
 
gooly:

Well I need th return() to leave the void function().

Nope. It doesn't mean return back to where you came from . . it means return this value. . . a void has no return value, so the return isn't needed.
 
RaptorUK:
Nope. It doesn't mean return back to where you came from . . it means return this value. . . a void has no return value, so the return isn't needed.

And how do I leave function right in the middle of it.

By the way I found the solution - grin - it is just

return;

Just skip the ().

THanks and happy trading ;)

Golly

 
gooly:

And how do I leave function right in the middle of it.

By the way I found the solution - grin - it is just

Yep, that is what WHRoeder was pointing out in his post.