stevehopwoodforex.com
https://www.stevehopwoodforex.com/phpBB3/
Print view

Prettify / Beautify / format your MQ4 code in 30 seconds
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=181
Page 1 of 1
Author:  AnotherBrian [ Fri Dec 23, 2011 2:24 pm ]
Post subject:  Prettify / Beautify / format your MQ4 code in 30 seconds

Here’s a really easy way to format your code. Formatting code makes it easier to read the logic flow, this little program automatically indents, fixed spaces and tabs. After my EA's get to big and add the debugging to the mix, my formatting starts to slowly go out the window. I run this every now and then, it takes under 30 seconds. This is a command line formatter.

Go get the file from here or here

These links take you to http://astyle.sourceforge.net. The page at one of these links will describe the switches you can use with the command line formatter. I've chosen some that work for me to get your started.

Instructions

1. unzip and find a file called AStyle.exe (windows) in the “bin” directory
2. put the file in the experts directory
3. open up a command prompt window (start>run>cmd)
4. drag the AStyle.exe file into the window
5. add a space then type this after the file name -A2 -s3 --mode=c
6. Add a space then drag and drop the file you want formatted, press enter
7. Done. You see the original was renamed with a “orig” extension.

How easy is that!

Also, see my earlier post on jEdit, a text editor for programmers
Author:  Dozer [ Fri Dec 23, 2011 5:37 pm ]
Post subject:  Re: Prettify / Beautify / format your MQ4 code in 30 seconds

Great tip. Thanks! :-)
Author:  markft [ Sun Dec 25, 2011 11:19 pm ]
Post subject:  Re: Prettify / Beautify / format your MQ4 code in 30 seconds

Hi Brian,
I use a GUI frontend for astyle called unifiedindentgui. It has a preview function and can create batch files for recursively formatting all files in the experts directory. Typing this from my phone so will not be able to put a link but you should find it easily by Googling.

Cheers
Author:  AnotherBrian [ Mon Dec 26, 2011 5:16 pm ]
Post subject:  Re: Prettify / Beautify / format your MQ4 code in 30 seconds

markft wrote:Hi Brian,
I use a GUI frontend for astyle called unifiedindentgui. It has a preview function and can create batch files for recursively formatting all files in the experts directory. Typing this from my phone so will not be able to put a link but you should find it easily by Googling.

Cheers
Hi Mark;

It would be great if you could post some quick instructions on how to do that. Sounds like another easy method with the advantage of formatting code in the entire directory!
Here's the link http://universalindent.sourceforge.net/
Author:  Ribelo [ Mon Dec 26, 2011 6:06 pm ]
Post subject:  Re: Prettify / Beautify / format your MQ4 code in 30 seconds

Try this http://universalindent.sourceforge.net/
Author:  markft [ Sat Jan 07, 2012 12:10 am ]
Post subject:  Re: Prettify / Beautify / format your MQ4 code in 30 seconds

AnotherBrian wrote:
markft wrote:Hi Brian,
I use a GUI frontend for astyle called unifiedindentgui. It has a preview function and can create batch files for recursively formatting all files in the experts directory. Typing this from my phone so will not be able to put a link but you should find it easily by Googling.

Cheers
Hi Mark;

It would be great if you could post some quick instructions on how to do that. Sounds like another easy method with the advantage of formatting code in the entire directory!
Here's the link http://universalindent.sourceforge.net/
Just came back from the Xmas holiday, will put together some instructions later this weekend.
Author:  markft [ Thu Feb 02, 2012 1:25 pm ]
Post subject:  Re: Prettify / Beautify / format your MQ4 code in 30 seconds

markft wrote:
AnotherBrian wrote:
markft wrote:Hi Brian,
I use a GUI frontend for astyle called unifiedindentgui. It has a preview function and can create batch files for recursively formatting all files in the experts directory. Typing this from my phone so will not be able to put a link but you should find it easily by Googling.

Cheers
Hi Mark;

It would be great if you could post some quick instructions on how to do that. Sounds like another easy method with the advantage of formatting code in the entire directory!
Here's the link http://universalindent.sourceforge.net/
Just came back from the Xmas holiday, will put together some instructions later this weekend.
Now that it is later this weekend :), and that I am doing this on another computer I thought I would put together the steps involved in using UniversalIndentGUI.

1- Download from http://universalindent.sourceforge.net/ and extract contents e.g. using 7zip.
2- Go to UniversalIndentGUI_win32 and run UniversalIndentGUI.exe
3- Select "Live Indent Preview" checkbox on the main form to see the effect of your indenting rule selection. There are plenty of indenters each with different options so experiment until you find settings you like.
4- Once happy with the indenter options go to Indenter->Save Indenter Config File to save the settings. Then click on Indenter->Create Indenter Call Shell Script menu item to create a batch file.

That's it - now you can run the batch file to recursively apply the settings to all files in a directory. Syntax is:
call_Artistic_Style.bat dirname filesuffix
call_Artistic_Style.bat filename
Example: call_Artistic_Style.bat temp cpp
Author:  AnotherBrian [ Sun Jul 08, 2012 3:00 pm ]
Post subject:  Re: Prettify / Beautify / format your MQ4 code in 30 seconds

If you're using this you're a coder and you would be interested in this thread.....
It's an editor with the Astyle built in.

http://www.stevehopwoodforex.com/phpBB3 ... &hilit=ide
All times are UTC Page 1 of 1