Tips, Ideas and tricks [ MetaTrader + Windows || Linux ]

 

Hello traders! 

The purpose of this discussion is to enable traders and programmers to share ideas and tricks on how to get simple necessity functionalities and aesthetics in MetaTrader and Editor.

Share:

1. Editor theme files.
2. Terminal theming ideas and guides.
3. Any relevant scripts like *.bat, *.sh, *.py or any other useful utility work-around.

... and anything else that aims at making life with MetaTrader enjoyable.

To start off, Here are the steps to some of my own utility ideas.


SYNC FILES ACROSS LOCAL TERMINALS ON WINDOWS

I know. We could just use the online versioning system. Right? Yeah. It works, but sometimes I need to share files between my local instances of MetaTrader while offline. I have a single development terminal that I use to version files online. I can't have multiple instances pushing their changes. 

It might look lengthy, but it is a simple thing to do, and it will save you time opening file explorer to copy or move files between terminals in the long run.

I created a script that does just that. Steps to get it to work:

1. Download and install autohotkeys for windows.
2. Open notepad and save the file on the desktop to anything you like, but the file extension should be *.bat (a batch script)
3.Right click on it and select edit.

4. Go to C:\Users\Anonymous3\AppData\Roaming\MetaQuotes\Terminal and note the instance that is connected online - your development terminal.(folder named in this manner : D0E8209F77C8CF37AD8BF550E51FF078)
5. If you have more than one instance, the folders with the above format may be more than one. Open and look inside the contents, try to notice your development files and note directory name like this above.
6. Repeat steps 4 and 5 and take note of your 'other' terminal that you would like to avail files to.
7. Copy the script bellow, replacing DESTINATION-DIRECTORY with the folder name of your 'other' terminal from step 6, and paste it in the file opened in step 3.

move C:\Users\Anonymous3\AppData\Roaming\MetaQuotes\Terminal\DESTINATION-DIRECTORY\MQL5\Sync C:\Users\Anonymous3\AppData\Roaming\MetaQuotes\Terminal\SOURCE-DIRECTORY\MQL5

8. Make sure the is a 'return' space at each end of line (to execute the line). 9. Save the script, close it and place it anywhere you prefer. Copy the file path to your script.(Sample:) C:\Users\YourUserName\Documents\Sync.bat 10. Open notepad and paste: (replacing the file path with yours from step 9.)
#NoEnv ; 
; #Warn ;
SendMode Input ;

^!s:: Run C:\Users\YourUserName\Documents\Sync.bat
11. The key pattern from autohotkey (^!s) is control + alt + s. 12. Save the file, close then run the file by checking it and pressing enter. 13. Right-click the file and create a shortcut. Cut the shortcut then press win + r and type shell:startup in the box. Paste the shortcut in the window that pops up. This will launch the script at every start-up. USAGE: Create a folder named 'Sync' in the root of the sandbox folder of the terminal (your development editor). Place files in it and press cntrl + alt + s anytime, anywhere, and the files will appear in the other terminal sandbox of your testing or trading terminal. Too easy? 👍 Two screenshots of my scripts are attached to illustrate.
Documentation on MQL5: Constants, Enumerations and Structures / Named Constants / Predefined Macro Substitutions
Documentation on MQL5: Constants, Enumerations and Structures / Named Constants / Predefined Macro Substitutions
  • www.mql5.com
//| Expert initialization function                                   | //| Expert deinitialization function                                 | //| Expert tick function                                             | //| test1                                                            |...
Files:
 
Nelson Wanyama:

Hello traders! 

The purpose of this discussion is to enable traders and programmers to share ideas and tricks on how to get simple necessity functionalities and aesthetics in MetaTrader and Editor.

Share:

... and anything else that aim's at making life with MetaTrader enjoyable.

To start off, Here are the steps to some of my own utility ideas.


SYNC FILES ACROSS LOCAL TERMINALS ON WINDOWS

I know. We could just use the online versioning system. Right? Yeah. It works, but sometimes I need to share files between my local instances of MetaTrader while offline. I have a single development terminal that I use to version files online. I can't have multiple instances pushing their changes. 

I created a script that does just that. Steps to get it to work:

Edit: Sync folders is not supported yet, unless it is zipped first. It is still a great tool as It's easier to open the folder and zip the contents.

 I couldn't get it to work on the command-prompt. Hint me if you have an idea.

Kindly  note: the hot-keys work regardless of whether the editor or terminal is up or not. 

An implementation on linux using a python script could be amazing, as user can input directories on the terminal during execution rather than having to 'hard-code' them. But having it done once and for all is useful too. 

You can extend the idea to copy the whole MQL directory to another instance to avail all your developments everywhere. You can also schedule a back-up of your entire directory by modifying the script and adding it to task scheduler or boot menu. If interested, ask and I will provide.

AutoHotKey is a great tool that has many useful features. Feel free to explore the endless possibilities.


Next post will feature how to switch MetaEditor theme files using the same hot-key approach.

 
Into themes? Check this forum post!!!https://www.mql5.com/en/forum/171246
Dark themes/skins for MetaTrader 4 & 5
Dark themes/skins for MetaTrader 4 & 5
  • 2017.02.28
  • www.mql5.com
Long hours trading requires optimizing screen brightness and contrast...
 

Something interesting from the admins.

We improve the editor gradually.

In today's release, compilation of C / C ++ projects will be available.  Now you can build both large and medium C / C ++ projects directly in the editor, saving time.  Including instant compilation of single * .cpp files, which is convenient for quickly creating DLL files.

In past releases of the editor:

  • expanded project opportunities
  • completely redesigned search boxes
  • added search on GitHub, MSDN, Stackoverflow with the ability to download projects
  • included support for * .py, * .ipynb files, including launch
  • included support for SQLite databases


Now we are actively working on and plan to show in the next release after today's release:

  • new debugger, head and shoulders above the past
  • new schema for displaying data under the debugger
  • new precise and non-braking profiler, which will show more precisely bottlenecks
  • new optimizations of the runtime


What we will also do:

  • We will completely rewrite the work of the navigator to get rid of the brakes on thousands of catalogs
  • rewrite the work of  MQL5 Storage
  • replace intelligence
  • improve work with projects - they are the basis for complex decisions
  • expand the settings, including hotkeys
  • folding most likely
Проекты и MQL5 Storage - Справка по MetaEditor
Проекты и MQL5 Storage - Справка по MetaEditor
  • www.metatrader5.com
это персональное онлайн-хранилище исходных кодов на MQL4/MQL5. Оно интегрировано в MetaEditor: вы можете сохранять и получать данных из хранилища прямо в редакторе. В  хранилище используется система контроля версий. Это значит, что вы всегда можете посмотреть, когда и как были изменены файлы, можете отменить любые изменения и вернуться к...
 

Speed programming!


Did you know that it is quite possible to speed up the execution of your for-loops by x2?

I bet not. See for yourself:

loops


Normal for-loop took 50% of my execution time. The second loop which took 25% was a two-directional loop. The third was a four-directional that I hoped would use less time but nope.

// two-directional loop
int array[1000];

for(int i=0;j<ArraySize(array); i<j &&!IsStopped();i++,j--,array[i] = 1.0,array[j] = 1.0);

This particular format of looping has proven to be two times faster than the traditional one-direction loop.

Increased number of directions didn't cause any notable improvement, but is still two times faster.

Try it today!

 

Bored of metaeditor UI? You could try using visual studio.

https://www.mql5.com/en/blogs/post/719548


I have tried, and loved the experience. I however disliked the c++ context intellisence predictions.

I still use it though.

Peace!

How to Code & Compile MQL5 in Visual Studio - A Complete Guide
How to Code & Compile MQL5 in Visual Studio - A Complete Guide
  • 2018.07.17
  • www.mql5.com
Well, we are talking here about the Open Source project from Microsoft called Visual Studio Code. It is completely FREE for personal and commercial use. Download it from here: code.visualstudio.com. Install it - the process is plain simple and common. Then, launch it. VSC will automatically launch a web page with initial tutorials, it is a good...
 

I like more screen, that's why I figured a way to hide windows title bars for open windows, on WINDOWS, with the hot-key ctrl + ] , thanks to auto-hotKey.

Now I can hide the terminal and editor title bars while trading and/or coding. The title bar blinks while popping intellisence predictions. A reason I dislike them the most. Find the compiled script below and the text script. To run the text script, you must install AutoHotKey.

The compiled will run without installation. Just run it and try the magic!!

Shortcuts:

NB: Make sure the window is not already maximized while using the hot-key. No harmful effect. I did not include the bit for the script to figure out if the window is not maximized, so it'll try maximizing it again.

ctrl + ] to hide the title bar and maximize the window, do it again to undo. 

Cheers.

Reason: