MetaEditor Compiler : unbalanced parenthesis

 

I have an EA wich I have checked numerous times over a period of many hours. Each time I compile the EA I receive this message

'}' - unbalanced parentheses                           C:\Program Files (x86)\MetaTrader - Alpari (US)\experts\Trail_Capture_EA.mq4 (254, 1)

I have used an advanced editor which has matched the parenthesis, the braces and the brackets. I have counted them each for open and closed pairs.

The error does NOT exist in my program. I am using Build 438. I am new to this forum and the MetaTrader 4 environment. What are the chances

that my issue/problem will be addressed? 

 
rfileger:

I have an EA wich I have checked numerous times over a period of many hours. Each time I compile the EA I receive this message

'}' - unbalanced parentheses                           C:\Program Files (x86)\MetaTrader - Alpari (US)\experts\Trail_Capture_EA.mq4 (254, 1)

I have used an advanced editor which has matched the parenthesis, the braces and the brackets. I have counted them each for open and closed pairs.

The error does NOT exist in my program. I am using Build 438. I am new to this forum and the MetaTrader 4 environment. What are the chances

that my issue/problem will be addressed? 

Why don't you comment out several block of your codes, from top to bottom, line by line, block by block, and then re-compile again - see if you can located the block of code that gives that error.

Do you understand how to do it ? 

/*

I'm a code and I'm comment out

*/
 

1) You could post your code here and see if a kind person can spot the problem.

2) You could copy and paste your code into the MT5 editor. It definitely won't compile properly in MT5, but the actual editor itself visually highlights both brackets/parentheses in the pair when you place your cursor over one. This might help you spot the problem.

3) There are two especially annoying places where brackets/parentheses problems like to hide. One is where the conditional ends and the command begins. It is really easy to do a typo here and end up with a bracket/parenthesis facing the correct way but being of the wrong type. These are really easy to miss when you scan over them - especially with only a few pixels difference and the implicit expectation that if it is facing the correct direction then it is the correct type. The other problem often occurs at the end of a string related command such as Print() or StringConcatenate() where you can have a long span of text which goes off the end of the screen and by the time you've checked all the way along it you've forgotten that it needs a final one right at the end.

 
phi.nuts:

Why don't you comment out several block of your codes, from top to bottom, line by line, block by block, and then re-compile again - see if you can located the block of code that gives that error.

Do you understand how to do it ? 

 


Thank you. I have done some of this but I will do more. I cut out an if statement with its braces and the statement and the compiler returned three errors each tied to a comment line. The code removed was

in the start() segment but the new errors were on the comment lines following the init() and the deinit() and another somewhere. They made no sense. 

 
clerin6:

1) You could post your code here and see if a kind person can spot the problem.

2) You could copy and paste your code into the MT5 editor. It definitely won't compile properly in MT5, but the actual editor itself visually highlights both brackets/parentheses in the pair when you place your cursor over one. This might help you spot the problem.


Thank you. I am using Visual SlickEdit which is a very powerful editor which matches the braces etc. As for the code there are lots of included routines that makes uploading the code more complicated. It may come to that.
 
I don't think an include file will compile if there is an error will it? If all the includes compile correctly, then that should mean the problem is with the main.
 
rfileger:

Thank you. I am using Visual SlickEdit which is a very powerful editor which matches the braces etc. As for the code there are lots of included routines that makes uploading the code more complicated. It may come to that.
 

Im having the same problem there are no missing parenthesis or braces in my program but it is giving me an error end of program unbalanced parenthesis. I even re-wrote the entire code over from scratch in a new file and got the same error. The chances of me making the same mistake twice is very slim .... are there any known glitches in Meta Editor 4?

 
Can you post your code ?
 

If the error was in one of the include files the error message should have told you which one.

 
Copy and paste your code into C# and that may help you identify the issue.  This sometimes helps me.  If that doesn't work start chopping out the code until it compiles.  This normally happens to me when I have to many or not enough parentheses.
Reason: