I saw a thread some were that showed different secrets of the MQ platform that were not documented or poorly documented. But can not find it again, so I started this thread. ND you can move it if you like.
This has to do with the code wizard templates not the chart templates. MT gives you a few general ones and some custom to build indicators. What I have done was to create my own general templates. One for experts, one for scripts, one for indicators, etc.. (see the screen shot). The trick is to create your own and name them as the ones that MQ will use. MQ doesnot know its different. It only knows it by the name. Be sure to make a backup copies of your work, as each time you up date to a new build MT will replace them with the original ones again, deleting yours.
Whats the benefit of this? It lets you start with your own code format and style. You can include links to your include files and libraries or any thing else you use with most of your work. Any MQ4 code or dlls can be used. The first code below is the MQ's template expert.mqt file. All one has to do is to remove the code as shown below and add any code block with comments etc. that you like. A very simple way.
The second code block is part of my expert.mqt file. As you can see there is a lot more you can do that MQ documentation shows. Remember this is only part of my file. You should create one that fits you.Code:<expert> type=EXPERT_ADVISOR </expert> #header# #property copyright "#copyright#" #property link "#link#" #extern_variables# <<<<<<<<<<<<<< REMOVE LINES BELOW AND ADD YOUR CODE >>>>>>>>>>>>>>>>> //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { //---- //---- return(0); } //+------------------------------------------------------------------+
My template may be a little more advance then one needs but it points out other things that can be done. This expert.mqt file has #define statments which the wizard fills in for me. If you notice there are no #property statements as they are included in to my main library file. Which gets feed the information from the wizard as well. The define statments now can be called or used any were in your code.
Code:<expert> type=EXPERT_ADVISOR revised=01-01-2007 </expert> //»»» MetaQuote [ MQ 4 ] »»»»»»»»»»»»»»»»»»»»»»»»«««««««««««««««««««««««««««««««««««««««««««««««««« //»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»» IDENTIFICATION DIVISION «««««««««««««««««««««««««««««««««« //»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»«««««««««««««««««««««««««««««««««««««««««««««««««« #define ProgramName "" #define SystemSymbol "" #define Author "#copyright#" #define eMail "#link#" #define TradeName "WinSoft Technology ™ " #define Licensee "" #define ModuleType "Expert Advisor" #define DateWriten "00.00.2008" #define VersionNumber "v1.00.01a" #define LastUpDate "" #define VersionRelease "Alpha Version" #define ProgramLanguage "MetaQuote ® MQL v4.00, b213" #define ScriptLanguage "Lore Language ® v2.70" #define SecurityLevel "Private Document" #define Documentation "see Documentation Division" #define CopyRight "CopyRight © 2008" /* ««« COPYRIGHT NOTICE: »»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»» This program is the unpublished works of the author and a part of his private library. It is protected as such under the United States Copyright laws. No part of this program may be used or re-produced for any purpose, in any form or by any means, or stored in a database or retrieval system. Making copies and or use of this program without the prior writen permission of the author, is strictly prohibited. No offers are being made to the public for distribution, sale, re-sale or usage. WinSoft Technology is a registed TradeName of the author and doesnot constitute a transfer. ~~~ #copyright# ~~~ //»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»«««««««««««««««««««««««««««««««««««««««««««««««««««« //»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»» ENVIRONMENTAL DIVISION ««««««««««««««««««««««««««««««««««« //»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»««««««««««««««««««««««««««««««««««««««««««««««««««*/ // ««« FILE LINKAGE SECTION: »»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»» #include <Implement/Lore Language ® v2.70/Script Engine © v2.70> #include <Implement/MetaQuote ® v4.00/MQ4 RunTime Module © v1.70> // ««« DEFINED CONSTANT SECTION: »»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»» // ««« EXTERN INPUT PARAMETER SECTION: »»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»» // ««« DEFAULT SYSTEM PROCESS SECTION: »»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»» // ««« SYSTEM DEFAULT SECTION: »»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»» // ««« GLOBAL SCOPE VARIABLES SECTION: »»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»» // ««« GLOBAL SCOPE ARRAYS SECTION: »»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»» // ««« MODULE DECLARATION SECTION: »»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»» //»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»«««««««««««««««««««««««««««««««««««««««««««««««««««« <<<<<<< REST OF TEMPLATE FILE HAS BEEN DELETED TO MAKE IT SHORTER FILE >>>>>>>>>>>>>>>>>>>
Theres a lot more to this then I am showing you but mine may be to complicated for most. If you start with the simple example above, then try adding some other things of your own. Just remember to save a back up copy of your work because MQ will replace it with their code each time you update MQ.
Keit



LinkBack URL
About LinkBacks




Reply With Quote


.
Bookmarks