Download MetaTrader 5

'if' - expressions are not allowed on a global scope

To add comments, please log in or register
Bassey Edet
1120
Bassey Edet  

Hi Coders,

I have issues with this compile error,

 

'if' - expressions are not allowed on a global scope

 

see attachment added 

 

can any one help?

Files:
Error_Code.png 193 kb
Carl Schreiber
Moderator
7961
Carl Schreiber  
Bassey Edet:

Hi Coders,

I have issues with this compile error,

 

'if' - expressions are not allowed on a global scope

 

see attachment added 

 

can any one help?

Count your brackets "(" - ")" and "{" - "}". If you code is too long I would use notepad++!
Fernando Carreiro
3916
Fernando Carreiro  
Bassey Edet: Hi Coders, I have issues with this compile error, 'if' - expressions are not allowed on a global scope, see attachment added. can any one help?
All executable code must be within a function (or class methods), such as the Event Handling functions. You cannot have "if()" statements outside of functions in the "global scope".

If it is indeed within functions, then check for mismatching brackets and braces, just as @Carl Schreiber has suggested.
Mladen Rakic
71044
Mladen Rakic  
Bassey Edet:

Hi Coders,

I have issues with this compile error,

 

'if' - expressions are not allowed on a global scope

 

see attachment added 

 

can any one help?

Starting from line 264 (and quite a lot more code after that) your code is not a part of any function.
Move that part to it's logical place within the function where it is supposed to do the desired job or, as Carl told : check all your brackets for a missing one
To add comments, please log in or register