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
Prettify / Beautify / format your MQ4 code in 30 seconds
-
Dozer
- Trader
- Posts: 25
- Joined: Wed Nov 16, 2011 4:32 pm
Re: Prettify / Beautify / format your MQ4 code in 30 seconds
Great tip. Thanks! 
-
markft
- Trader
- Posts: 82
- Joined: Thu Dec 08, 2011 12:06 pm
- Location: Sydney, Australia
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
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
-
AnotherBrian
Re: Prettify / Beautify / format your MQ4 code in 30 seconds
Hi Mark;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
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/
-
Ribelo
- Trader
- Posts: 62
- Joined: Thu Nov 17, 2011 12:58 am
-
markft
- Trader
- Posts: 82
- Joined: Thu Dec 08, 2011 12:06 pm
- Location: Sydney, Australia
Re: Prettify / Beautify / format your MQ4 code in 30 seconds
Just came back from the Xmas holiday, will put together some instructions later this weekend.AnotherBrian wrote:Hi Mark;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
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/
-
markft
- Trader
- Posts: 82
- Joined: Thu Dec 08, 2011 12:06 pm
- Location: Sydney, Australia
Re: Prettify / Beautify / format your MQ4 code in 30 seconds
Now that it is later this weekendmarkft wrote:Just came back from the Xmas holiday, will put together some instructions later this weekend.AnotherBrian wrote:Hi Mark;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
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/
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
-
AnotherBrian
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
It's an editor with the Astyle built in.
http://www.stevehopwoodforex.com/phpBB3 ... &hilit=ide