OnChartEvent throws error

 

Hi,

in my MQL4-Expert Advisor the following code always throws an error due to missing {. But I don't understand why.

void OnChartEvent(const int id, const long& lparam, const double& dparam, const string& sparam)
  {
   if(id==CHARTEVENT_KEYDOWN) Print(lparam);
  }

Thanks.

 
Ich555:

Hi,

in my MQL4-Expert Advisor the following code always throws an error due to missing {. But I don't understand why.

Thanks.

you need to post all the code, along with the proper error message including line number otherwise its just a guessing game 

 

It is really only this subroutine posted above that produces these errors:

any guesses?

 
Ich555 #: It is really only this subroutine posted above that produces these errors: any guesses?

No, the problem can easily originate in the code above it, but only give an error further on when it is detected in the flow of compilation.

The code you have shown, is not the cause of the error.

 
Fernando Carreiro #:

No, the problem can easily originate in the code above it, but only give an error further on when it is detected in the flow of compilation.

The code you have shown, is not the cause of the error.

Hm, I've tried it again and now it worked....

Must have been some kind of cosmic conspiracy.

Thanks.

 
Ich555 #: Hm, I've tried it again and now it worked.... Must have been some kind of cosmic conspiracy. Thanks.

One possibility is ... that you copy/pasted code from a website via Firefox, and it inserted non-break spaces which messes up the code. This is a problem with recent versions of the FireFox browser.