Why? - page 2

 

I see I am getting other similar errors also. Looks like my code is a mess!

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

 
GumRai:

It is probably the code prior to your posted code

If it has one too many "}"

Then you will get that error


i agree with "GumRai"
 

Ernest,

Try Tools\Options\General and tick the "Highlight matching brackets" box

Makes finding errors like this much easier :)

 
ernest02:

I see I am getting other similar errors also. Looks like my code is a mess!

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

The problem is, as said, that you made an error in the placement of your for loop code.

You need to copy and paste more code here if you can't find the problem.

 
ernest02:

I see I am getting other similar errors also. Looks like my code is a mess!

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


For those missing ( or ) or { or } I use(d) Notepad++ it can count the brackets to show 'un-equalness' this way.

But the new mt4 editor has better tools for that: Tools->General->enable matching brackets - it easier to see where the {} do not fir.

Gooly

 

I found the bloody culprit! I had 46 "{" and 47 "}".

THANKS FOR ALL THE HELP GUYS!!