Editor Go to line

 

Hi, actually two questions, first: When you got an error from the compiler in line eg. 375. How do you get to that line? I haven't found any "go to" line in the editor, so what I do is I write xxx in some part of the code, hit compile again and narrow down the line where the code has the error. Is it there any better way?

and second, What can you do with this return from the compiler:" \end _of_program- unbalanced left parenthesis" and then it gives you the last line of code, however the error is some other place. It is not big deal with a small program, but if you have several houndred lines, it is a pain in the a... to find the missing parenthesis.

 
1121048:

When you got an error from the compiler in line eg. 375. How do you get to that line? I haven't found any "go to" line in the editor, so what I do is I write xxx in some part of the code, hit compile again and narrow down the line where the code has the error. Is it there any better way?

Double click the error message.
 
1121048:

Hi, actually two questions, first: When you got an error from the compiler in line eg. 375. How do you get to that line? I haven't found any "go to" line in the editor, so what I do is I write xxx in some part of the code, hit compile again and narrow down the line where the code has the error. Is it there any better way?

and second, What can you do with this return from the compiler:" \end _of_program- unbalanced left parenthesis" and then it gives you the last line of code, however the error is some other place. It is not big deal with a small program, but if you have several houndred lines, it is a pain in the a... to find the missing parenthesis.

Hi 1121048,


When you compile and get errors...there is sometimes a long list of errors...and it's best to work on the top error listed because the other errors may be from the first problem. Those other errors will go away when you solve the first problem.

Then recompile and work on the next problem if any.

Some errors are found on the line number indicated. Go to that line by double clicking on the error message as loo3x suggests.

Most errors however are usually found above the line indicated...and most likely they are the last changes you made to the code.

Simple technique to find the errors...

Use your Undo Arrow...go back step by step and re-compile each time until it compiles OK.

Then redo your code from there.

In the future, make little changes and compile each time. That way you are never lost in the errors.

There are also other programs that can help you find un-matched brackets or parentheses...like NotePad++.

Hope this helps,

Robert

 
cosmicbeing:

Hi 1121048,


When you compile and get errors...there is sometimes a long list of errors...and it's best to work on the top error listed because the other errors may be from the first problem. Those other errors will go away when you solve the first problem.

Then recompile and work on the next problem if any.

Some errors are found on the line number indicated. Go to that line by double clicking on the error message as loo3x suggests.

Most errors however are usually found above the line indicated...and most likely they are the last changes you made to the code.

Simple technique to find the errors...

Use your Undo Arrow...go back step by step and re-compile each time until it compiles OK.

Then redo your code from there.

In the future, make little changes and compile each time. That way you are never lost in the errors.

There are also other programs that can help you find un-matched brackets or parentheses...like NotePad++.

Hope this helps,

Robert



Thank You Robert and loo3x, that helps big time, I didn't know about the double click(intuitive ?), tha is better than my method of inserting some garbage and re-compiling. However, almost any text editor out there has the "go to" under edit tab. I'm not bashing MT, but I don't think it will be too hard (programmatically) to improve MT editor in future releases.

 

You can also comment out /* portions of the code */ until is compiles. The error is inside the comment, divide and conquer.

I personally use notepad2 with code folding option. Search for the opening brace, the highlighting shows the matching one, search for next. No match, found error. NP2 can jump directly to a line number.

 
WHRoeder:

You can also comment out /* portions of the code */ until is compiles. The error is inside the comment, divide and conquer.

I personally use notepad2 with code folding option. Search for the opening brace, the highlighting shows the matching one, search for next. No match, found error. NP2 can jump directly to a line number.


How do you deal with compiling when using another editir? Copy and paste to MT4 editor, then hit compile ? Is it there a way to tell MT4 to bypass its own editor and use a third party one?. Sorry if this is too ovious, I might be having a brain fart or something.

Thanxs

 
The editor will show the current line number and column in the status bar.
 
1121048:


How do you deal with compiling when using another editir? Copy and paste to MT4 editor, then hit compile ? Is it there a way to tell MT4 to bypass its own editor and use a third party one?. Sorry if this is too ovious, I might be having a brain fart or something.

No copy/paste necessary, just press compile, the mt4 will compile the latest from disk, not what the editor is showing.

The only problem is if you make A change in the mt4 editor, that's the version the editor opened with not the latest, if you compile that old version is written and you loose all edits from the external editor. Never edit in the mt4!

On notepad2, control-L pops up the editor. F5 compiles, F4 switches to the tester.

 
WHRoeder:

No copy/paste necessary, just press compile, the mt4 editor will compile the latest from disk.

Actually it is not the MetaEditor that compiles it, it is the compiler. You don't even need MetaEditor to compile the code. Just bind some hotkey of your preferred editor to launch the compiler.
 
bernd #: The editor will show the current line number and column in the status bar.

We can see the error Line but where is the column..

as in my code.. it shows Line no. 54 column 2 so where is the column to rectify.

This is the code : 

        ulong ticket = OrderSend(_Symbol, ORDER_TYPE_SELL, positionSize, entryPrice, 3, stopLoss, entryPrice - takeProfit, "Bearish Engulfing", MagicNumber, 0, 0, clrRed);

it says error on line 54 column 2

 
DEEPAK SONI #: We can see the error Line but where is the column.. as in my code.. it shows Line no. 54 column 2 so where is the column to rectify.

This is the code : 

        ulong ticket = OrderSend(_Symbol, ORDER_TYPE_SELL, positionSize, entryPrice, 3, stopLoss, entryPrice - takeProfit, "Bearish Engulfing", MagicNumber, 0, 0, clrRed);

it says error on line 54 column 2

You have not mentioned what error was reported, but depending on the error code, it should be analysed in context. So also, look at lines before it.