Forex



Go Back   Forex Trading > Training > Metatrader > Metatrader 4 mql 4 - Development course > Lessons
Forex Forum Register More recent Calendar Advertising Others Help






Register
Welcome to Forex-TSD!, one of the largest Forex forums worldwide, where you will be able to find the most complete and reliable Forex information imaginable.

From the list below, select the forum that you want to visit and register to post, as many times you want. It’s absolutely free. Click here for registering on Forex-TSD.

Exclusive Forum
The Exclusive Forum is the only paid section. Once you subscribe, you will get free access to real cutting-edge Trading Systems (automated and not), Indicators, Signals, Articles, etc., that will help and guide you, in ways that you could only imagine, with your Forex trading.
  • Elite Section
    Get access to private discussions, specialized support, indicators and trading systems reported every week.
  • Advanced Elite Section
    For professional traders, trading system developers and any other member who may need to use and/or convert, the most cutting-edge exclusive indicators and trading systems for MT4 and MT5.
See more

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 03-31-2008, 08:32 PM
cockeyedcowboy's Avatar
Senior Member
 
Join Date: Nov 2005
Posts: 486
cockeyedcowboy is on a distinguished road
The Code Wizard Templates.

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.


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);
  }
//+------------------------------------------------------------------+
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.

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
Attached Images
File Type: jpg Templates.jpg (26.5 KB, 530 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #2 (permalink)  
Old 04-01-2008, 01:07 AM
Linuxser's Avatar
User Root
 
Join Date: May 2006
Location: Helliconia (Spring)
Posts: 4,412
Blog Entries: 56
Linuxser has a reputation beyond reputeLinuxser has a reputation beyond reputeLinuxser has a reputation beyond reputeLinuxser has a reputation beyond reputeLinuxser has a reputation beyond reputeLinuxser has a reputation beyond reputeLinuxser has a reputation beyond reputeLinuxser has a reputation beyond reputeLinuxser has a reputation beyond reputeLinuxser has a reputation beyond reputeLinuxser has a reputation beyond repute
Glad to find a friend in the road.

I was testing ideas like you have. Mainly focused on crate a custom installation of MT4. Something like Forex-TSD MT4.

Because that I've asked some help: Exe Extractor and INNO setup

I was looking for way to include many indicators/EA/servers in one setup.

This indeed to extract a MT setup, include what you want and create a new setup with maybe 100 indicators or more.

Main problem is, as you showed in the picture, after setup is running a temp folder (presetup) is created but the file inside are delivered in a way I can't understand.

I believe the next step after you've clicked everything the setup will unpack the default files.

Maybe we could work together.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #3 (permalink)  
Old 04-01-2008, 03:20 AM
Senior Member
 
Join Date: Jan 2006
Posts: 1,119
omelette is on a distinguished road
Quote:
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
Hell, it's too complicated as it is!

Could you give a specific example of where altering these template files would prove useful? I see references to your scripting language included in the examples (I first recall seeing this in a Hans123 EA you posted on StrategyBuilderFX years ago..). What added functionality does this provide, above and beyond what one could achieve with MQL?

Personally, I'd be all for delving deeper into the innards on MT if I thought I had well and truly cracked the 'HolyGrail' problem - until then, it just seems like a solution that is looking for a problem...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #4 (permalink)  
Old 04-01-2008, 04:03 AM
cockeyedcowboy's Avatar
Senior Member
 
Join Date: Nov 2005
Posts: 486
cockeyedcowboy is on a distinguished road
Quote:
Originally Posted by omelette View Post
Hell, it's too complicated as it is!

Could you give a specific example of where altering these template files would prove useful? I see references to your scripting language included in the examples (I first recall seeing this in a Hans123 EA you posted on StrategyBuilderFX years ago..). What added functionality does this provide, above and beyond what one could achieve with MQL?

Personally, I'd be all for delving deeper into the innards on MT if I thought I had well and truly cracked the 'HolyGrail' problem - until then, it just seems like a solution that is looking for a problem...

You are right my version of the Hans123 EA was created using this setup as a starting point. If you remember that then you will remember that alot of people wanted me to give them my libraries which I refused. May be I should show people how to create multi purpose libraries of there own.

Any ways, this is not about libraries and its in no way going to help you break the mystery of the HolyGrail. I use this to set up a begaining file the way I start a code project which includes my external libraries. When you start a new code project the file that mq creates looks like whats in the screen shot attached. You can however, have mq create the file containing anything you want by altering the existing files. The file can be made to your preferance and style of coding. You do not have to use the default mq format. Once you change the file, mq will start with your file after that not the MQ file you see below.


Keit
Attached Images
File Type: jpg Typical EA starting file.jpg (34.4 KB, 499 views)

Last edited by cockeyedcowboy; 04-01-2008 at 04:10 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #5 (permalink)  
Old 04-01-2008, 04:23 AM
cockeyedcowboy's Avatar
Senior Member
 
Join Date: Nov 2005
Posts: 486
cockeyedcowboy is on a distinguished road
Linuxser

If I'am understanding you right your talking about something different. You can use a setup program to install either a complete MT platform with all your other files or have it install over an existion MT directory. Theres one problem most install packages will write to the windows registry keys. These entries is how windows knows were the files are located. Most people using MT tend to move files around and delete file manually when no longer need. this will cause registry enteries not to be cleared, if one doesnot use the uninstall to remove the programs. Once the files are deleted manually you may not be abile to use the uninstall after that to clear the registry keys. What you are asking can be done but you need to do it without writing to the registries.

Keit
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #6 (permalink)  
Old 04-01-2008, 04:46 AM
Linuxser's Avatar
User Root
 
Join Date: May 2006
Location: Helliconia (Spring)
Posts: 4,412
Blog Entries: 56
Linuxser has a reputation beyond reputeLinuxser has a reputation beyond reputeLinuxser has a reputation beyond reputeLinuxser has a reputation beyond reputeLinuxser has a reputation beyond reputeLinuxser has a reputation beyond reputeLinuxser has a reputation beyond reputeLinuxser has a reputation beyond reputeLinuxser has a reputation beyond reputeLinuxser has a reputation beyond reputeLinuxser has a reputation beyond repute
Quote:
Originally Posted by cockeyedcowboy View Post
Linuxser

If I'am understanding you right your talking about something different. You can use a setup program to install either a complete MT platform with all your other files or have it install over an existion MT directory. Theres one problem most install packages will write to the windows registry keys. These entries is how windows knows were the files are located. Most people using MT tend to move files around and delete file manually when no longer need. this will cause registry enteries not to be cleared, if one doesnot use the uninstall to remove the programs. Once the files are deleted manually you may not be abile to use the uninstall after that to clear the registry keys. What you are asking can be done but you need to do it without writing to the registries.

Keit
Hi,

I re-read the first post carefully and I saw something different first time. Sometimes you see what you want .

Problem is not the registry because MT works clean in presetup. Just after last click some values are write into the registry, the problem is no easy to solve. In fact you can edit some files previous installation as cockeyedcowboy is editing templates to set directory, name, whatever, it's very funny.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #7 (permalink)  
Old 04-01-2008, 02:01 PM
Senior Member
 
Join Date: Jan 2006
Posts: 1,119
omelette is on a distinguished road
Quote:
Originally Posted by cockeyedcowboy View Post
You are right my version of the Hans123 EA was created using this setup as a starting point. If you remember that then you will remember that alot of people wanted me to give them my libraries which I refused. May be I should show people how to create multi purpose libraries of there own.
.....
Yes, I do remember that also - but this was not an indirect way of asking you for them now either, I was just genuinely curious!

Thanks for pointing out exactly what templates you were referring to, I wasn't at all sure, but have now seen the light. I still think though that although it's useful to be able to 'arrange' your code-space to your own requirements, it is a little above-and-beyond what most still struggling with MQL itself (myself included) will devote much time to - just my opinion obviously!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #8 (permalink)  
Old 04-01-2008, 04:33 PM
cockeyedcowboy's Avatar
Senior Member
 
Join Date: Nov 2005
Posts: 486
cockeyedcowboy is on a distinguished road
Quote:
Originally Posted by omelette View Post
Yes, I do remember that also - but this was not an indirect way of asking you for them now either, I was just genuinely curious!

Thanks for pointing out exactly what templates you were referring to, I wasn't at all sure, but have now seen the light. I still think though that although it's useful to be able to 'arrange' your code-space to your own requirements, it is a little above-and-beyond what most still struggling with MQL itself (myself included) will devote much time to - just my opinion obviously!

Yes Omelette,

As I said in the first post, that what I use is, in most cases, too advance then what most will need. People here came because of Forex not programing, however a lot have picked up on the programing end too. Just though to give some idears.

In case some are still a little confussion as to which templates and wizard I am talking about ...

Keit
Attached Images
File Type: jpg wizard.jpg (87.6 KB, 424 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Templates to create EAs and Indicators newdigital Questions 26 07-24-2009 09:27 AM
Lesson 18 - Working with templates codersguru Metatrader 4 mql 4 - Development course 13 08-03-2008 02:39 AM
EA Templates xxDavidxSxx Expert Advisors - Metatrader 4 15 01-29-2008 01:38 PM
Profitunity Templates....... Qbert006 Indicators - Metatrader 4 2 03-06-2006 08:33 PM


All times are GMT. The time now is 08:13 PM.



Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.