Portfolio Maker Documentation
Combine FSBPro-Generated Strategies Into A Single EA
Forex Strategy Builder Professional is the leading software platform for generating and analyzing advanced MetaTrader strategies. It provides an easy way to build forex strategies by combining various technical indicators, and enables users to create Expert Advisors (EA) that act at several levels — by using logical groups for the trading rules.
Portfolio Maker is a new tool that allows you to bundle the individual strategies created by Forex Strategy Builder Professional into a single EA. This makes it much easier to manage and trade a portfolio of FSBPro-generated strategies.
Forex Strategy Builder uses a Strategy Generator that creates 1000’s of strategies per hour. The best strategies are automtically added to a ‘Collection’, where they can later be filtered (using a variety of different metrics), refined, back-tested and re-optimized to achieve the best statistics. Once you are satisfied with the results, the source code (*.mq4) for each strategy can be exported as stand-alone Expert Advisor (EA) to be used in the MetaTrader trading platform.
With Forex Strategy Builder you create a “portfolio” of dozens, finely tuned, individual EAs. However, an important limitation of MetaTrader requires that each EA be attached to a separate chart. This creates a new set of problems that traders didn’t have to contend with prior to EA portfolios:
- MetaTrader is limited to 100 charts
- Each MetaTrader chart consumes CPU resources — such that a single instance of a MetaTrader terminal session can consume the majority of a machine’s resources and cause it to perform sluggishly
- It is tedious, time-consuming and error-prone to manually create dozens of charts and attach individual EAs
Whereas previously our time and effort was spent on developing one (or a few) profitable EAs, with Forex Strategy Builder Professional we now have a new problem — how to manage portfolios that include dozens or 100’s of strategies. What a great problem to have!! Well — Portfolio Maker provides a solution. Not only can you now bundle dozens or hundreds of strategies into a single EA, but you can also back test this portfolio EA in MT4’s Strategy Tester and also analyze those results using MT4 Tracker. It really doesn’t get any better than this…
Portfolio Maker is a Windows application that can be used to bundle individual strategies created by FSB Professional into a single EA. It was developed to complement Popov’s software that generates large collections of profitable EAs — where each EA is attached to its own MT4 chart. There are a number of compelling benefits to be gained by combining a portfolio of individual strategies into a single EA:
Portfolio Maker Features (referring to the resultant portfolio EA):
- The Portfolio EA Requires Only ONE MT4 chart
- The Portfolio EA Can Be Back-Tested Using MT4’s Strategy Tester
- The Back-Testing Results Can Be Further Analyzed By MT4 Tracker
Portfolio Maker is easy to use. However, there are a number of steps to follow — so, please pay close attention. The reason why these steps are necessary is because we are taking the source code (*.mq4) from many stand-alone Expert Advisors, extracting the strategies and indicators, and rearranging the source code so it can be re-built as a single, portfolio EA.
Here are the steps we’ll be performing:
- Use FSB Pro to create the strategies you wish to combine into a single, portfolio EA.
- From FSB Pro, export the strategies in the form of their *.mq4 source files.
- Launch Portfolio Maker and add all the *.mq4 strategy files that will be combined into a single, EA.
- Specify the location of your MetaTrader ‘MQL4’ folder so that Portfolio Maker will know where to create all the intermediate files necessary to build a single EA.
- From Portfolio Maker, press the ‘Create’ button to actually create all the *.mq4 and *.mqh source code files.
- From within the MetaEditor program, locate (in the ‘Experts’ folder) the *.mq4 file that was just created and press the ‘Compile’ button. This will compile the main *.mq4 along with all the support *.mqh files necessary to build this single EA that now includes all your strategies.
Before we begin, there is one important requirement that must be followed in order for this all to work — and that is you must use magic numbers as the filenames for all your individual strategies. This is how Portfolio Maker helps you keep track of strategies and their corresponding magic number — we do this by using magic numbers as filenames. Also, it is possible for Portfolio Maker to programmatically determine the filenames and, in this way, frees you from having to manually input magic numbers. Below is an example:
As as example, we use the following format to name strategy files — you can choose something completely different. The only requirement is the filename must be a valid magic number — that is, it can only include numerals (no letters, punctuation, spaces, etc):
We follow a particular format when creating filenames — again, you can choose something different, whatever you think works best:
We use the format S-P-GGG-NNN, where
S => Symbol
P => Period
G => Group Number
N => Strategy Number (within the group)
For ‘S’ we use:
1 => EURUSD
2 => USDCHF
3 => USDJPY
4 => GBPUSD
For ‘P’ we use:
1 => M1
2 => M5
3 => M15
4 => M30
5 => H1
6 => H4
7 => D1
16018001 => EURUSD, H4, Group 18, Strategy #1
26002005 => USDCHF, H4, Group 2, Strategy #5
And then we’ll save the strategies in folders with names such as ‘16018xxx’ — e.g. folder 16018xxx includes 26 strategies, with filenames 16018001.xml through 16018026.xml.
Once you’ve created your strategies (*.xml) and exported the corresponding *.mq4 files, then we are ready to begin…
Step 1: Enter a name for the new, portfolio EA *.mq4 file. This is how it will appear in MetaTrader. Do not include the *.mq4 extention — Portfolio Maker will automatically add that.
Step 2: Enter a short description of the portfolio. This will be displayed near the top of the MetaTrader chart.
Step 3: Very important — enter the location of your MetaTrader’s ‘MQL4’ folder. This is easily found from within the MetaTrader terminal using the main menu: File / Open Data Folder / and select the ‘MQL4’ folder. The reason this is important is because within the MQL4 folder lives the ‘Experts’ and ‘Include’ folders where Portfolio Maker creates the *.mq4 and *.mqh files you’ll need for building the single EA.
Step 4: Using the ‘Add’ button, navigate to the folder where all the *.mq4 strategy files were located and select the ones you wish to add to the portfolio EA.
Step 5: Decide whether the entry size of each position will be based on lots or percent (of account). A portfolio can NOT be a mixture of strategies that use lots and percentages — choose one. If using lots, the 4 input values should be in terms of lots. If using percent, the 4 input values should be percentages. These input values are applied globally and do overwrite the original values that were used when the strategy was created by FSB-Pro. Please keep in mind when using percent the strategy code treats these values as percentages and the algorithm used to convert to lots will divide by 100. So, if you specify a percent that is too small — e.g. 0.01 — then the conversion will fail because the computed lot size will be zero. We’ve tested using percentages of 1 or greater.
Step 6: Press the ‘Create’ button. This creates the *.mq4 and *.mqh files you’ll subsequently need for building the single, portfolio EA.
Step 7: You are almost done. What remains is to launch MetaEditor, locate the *.mq4 file that you named in ‘Step 1’ and press the ‘Compile’ button. If all goes well then a new *.ex4 file will be created — this is your new portfolio EA that includes all your strategies. This file is completely self-contained and you can copy it to other MetaTrader installations without any other requirements.
Step 8: This step is optional — though very useful. You can now use MetaTrader’s Strategy Tester to back-test your portfolio EA. We do not recommend using the ‘Every tick’ model — since that would probably take a few years. But using ‘Open prices’ or ‘Control points’ will usually complete within a few minutes — depending on how many strategies are included in your portfolio, the data horizon, and the period. The more data points that are included in your back test, then the longer it will take. To give you an idea, our favorite period is H4 and we’ll use a data horizon of 6 – 12 months, which may take around 3 minutes to complete on a fast machine. And, finally, when the back-test completes it will create a special log file that includes all the trades. This log file can then be used by MT4 Tracker to further analyze how each of your strategies performed during the back-testing period.
There are two types of input values:
- Entered from Portfolio Maker
- Entered from the EA when attaching to a chart
Input Values Entered From Portfolio Maker
The amounts used for ‘Entry’, ‘Maximum’, ‘Adding’ and “Reducing’ are ‘global’ values that apply to all the strategies in a portfolio. It may be that when creating strategies in FSB-Pro your different strategies use different amounts. And this makes sense when strategies are intended to be used individually. But when strategies are combined into a single EA, then these amounts take on a different meaning. It now makes sense for the amounts to be the same for each strategy in the portfolio because it gives you some control over how much of your account is at risk when the portfolio is trading.
Input Values Entered When Attaching The Portfolio EA To A Chart
Your portfolio EA may contain dozens (or hundreds) of strategies, and managing the overall trading pattern of a portfolio EA is much different than a single EA — i.e. if you don’t pay close attention then your exposure can quickly grow larger than what you are comfortable with. These inputs allow you some control over how frequently your portfolio will open new positions.
Stop trading when FreeMargin drops below this value: If account’s Free Margin drops below this value then do not open any new trades. Default is ‘0’.
Stop trading when Balance drops below this value: If account’s Equity drops below this value, the expert will close out all positions and stop automatic trading. Default is ‘500’.
Stop trading when Margin exceeds this value: If account’s Margin rises above this value then do not open any new trades. Default is ‘99999’.
Stop trading when opened positions exceed this value: If portfolio’s open positions exceed this value then do not open any new trades. Default is ‘99999’.
Stop trading when floating loss drops below this value: If account’s floating loss drops below this value then do not open any new trades. Default is ‘-99999’.
For example, suppose you want to stop using a portfolio EA but there are still a number of open (pending) trades. If you set the 3rd input (‘Stop trading when Margin exceeds this value’) to ‘1’, then no new trades will be opened and pending trades will gracefully close. The alternative would be to remove the EA (or close the chart window) and then manually close each pending trade.
The 3rd input can also be useful if you wish to limit the number of pending trades if you discover the portfolio is opening more trades than you are comfortable with.
Minimum WinRatio (per strategy): If a strategy’s WinRatio falls below this value (e.g. 0.60), then it will no longer be able to open new positions. However, it will still be used to close any positions that currently remain open.
Maximum Consecutive Losses (per strategy): If a strategy’s consecutive losses exceeds this value (e.g. 2) , then it will no longer be able to open new positions. However, it will still be used to closed any positions that currently remain open.
Portfolio Maker software is copyrighted © by Nuts About Nets, 2006-2017.
FSB Portfolio Maker – Application For Creating A Portfolio Expert Advisor From FSB-Generated Strategies
END USER LICENSE AGREEMENT (EULA)
Except where otherwise noted, all of the documentation and software included in the Portfolio Maker software package is copyrighted by Nuts About Nets, LLC.
This Nuts About Nets, LLC End-User License Agreement (“EULA”) is a legal agreement between you (either an individual or a single entity) and Nuts About Nets, LLC for the Portfolio Maker software product identified above, which includes computer software and may include associated media, printed materials, additional computer software applications, and “online” or electronic documentation (“SOFTWARE PRODUCT”).
By downloading, installing, copying, running, executing, or otherwise using any portion of the SOFTWARE PRODUCT, you agree to be bound by the terms of this EULA. If you do not agree to be bound to the terms of this EULA, then please do not download, install, accept (for example, and not by way of limitation, by checking the “I DO NOT ACCEPT” box in connection with this EULA at the beginning of the software download, installation, and/or initial execution process), or permit others to download, install, copy, run, execute, or otherwise use the SOFTWARE PRODUCT.
SOFTWARE PRODUCT LICENSE
The SOFTWARE PRODUCT is protected by copyright laws and international copyright treaties, as well as other intellectual property laws and treaties. The SOFTWARE PRODUCT is licensed, not sold.
1. GRANT OF LICENSE. This EULA grants you the following rights:
a. SOFTWARE PRODUCT. You may install and use one copy of the SOFTWARE PRODUCT on a single computer, including a workstation, laptop or notebook machine, terminal or other digital electronic device (“COMPUTER”).
b. Storage/Network Use.
You may also store or install a copy of the SOFTWARE PRODUCT on a storage device, such as a network server, used only to install or run the SOFTWARE PRODUCT on your other COMPUTERS over an internal network; however, you must acquire and dedicate a license for each separate COMPUTER on or from which the SOFTWARE PRODUCT is installed, used, accessed, displayed or run. A license for the SOFTWARE PRODUCT may not be shared or used concurrently on different COMPUTERS.
c. No Sale. You acknowledge and agree that this copy of the SOFTWARE PRODUCT has been licensed to you pursuant to the terms and conditions of this EULA and that such copy of the SOFTWARE PRODUCT has not been sold to you. In addition, you acknowledge that this copy of the SOFTWARE PRODUCT is not subject to the “first sale” doctrine as that term is defined in United States Copyright laws.
d. Restrictions. You agree (i) not to copy, transfer, assign, rent, resell, distribute or use the SOFTWARE PRODUCT other than as expressly authorized in this EULA, (ii) not to remove any copyright notice, trademark notice, and/or other proprietary legend or indication of confidentiality set forth on or contained in the SOFTWARE PRODUCT, and (iii) to refrain from using the SOFTWARE PRODUCT for any other purpose other than as expressly authorized in this EULA.
2. DESCRIPTION OF OTHER RIGHTS AND LIMITATIONS.
a. Limitations on Reverse Engineering, Decompilation, and Disassembly. You may not reverse engineer, decompile, recompile, precompile, disassemble, hack, port, or otherwise attempt to discover the source code to the SOFTWARE PRODUCT.
b. Support Services. Nuts About Nets, LLC may provide you with support services related to the SOFTWARE PRODUCT (“Support Services”). Any supplemental software code provided to you as part of the Support Services shall be considered part of the SOFTWARE PRODUCT and subject to the terms and conditions of this EULA.
c. Software Transfer. You may permanently transfer all of your rights under this EULA, provided you retain no copies, you transfer all of the SOFTWARE PRODUCT (including all component parts, the media and printed materials, any upgrades, and this EULA) and the recipient agrees to the terms of this EULA. If the SOFTWARE PRODUCT is an upgrade, any transfer must include all prior versions of the SOFTWARE PRODUCT.
d. Termination. Without prejudice to any other rights, Nuts About Nets, LLC may terminate this EULA if you fail to comply with the terms and conditions of this EULA. In such event, you must destroy all copies of the SOFTWARE PRODUCT and all of its component parts.
3. INTELLECTUAL PROPERTY RIGHTS.
All title and intellectual property rights in and to the SOFTWARE PRODUCT, and any copies you are permitted to make herein are owned by Nuts About Nets, LLC. Furthermore, you agree that Nuts About Nets, LLC owns all right, title, interest, and intellectual property rights in and to the SOFTWARE PRODUCT and in all patents, trademarks, trade names, inventions, copyrights, know how and trade secrets, and any related applications or extensions, relating to the design, manufacture, operation or service of the SOFTWARE PRODUCT.
4. EXPORT RESTRICTIONS.
You acknowledge that the SOFTWARE PRODUCT is subject to United States export jurisdiction. You agree to comply with all applicable international and national laws that apply to the Software Product and/or to the export of technical data, including the United States Export Administration Regulations, as well as end-user, end-use, and destination restrictions issued by the United States and other governments. You agree that you will not export or re-export the SOFTWARE PRODUCT (or portions thereof) to any country, person or entity subject to U.S. export restrictions. You specifically agree not to export or re-export the SOFTWARE PRODUCT (or portions thereof): (i) to any country subject to a U.S. embargo or trade restriction; (ii) to any person or entity who you know or have reason to know will utilize the SOFTWARE PRODUCT (or portion thereof) in the production of nuclear, chemical or biological weapons; or (iii) to any person or entity who has been denied export privileges by the U.S. government.
5. DISCLAIMER OF WARRANTIES.
To the maximum extent permitted by applicable law, Nuts About Nets, LLC and its suppliers provide the SOFTWARE PRODUCT and any (if any) Support Services “AS IS AND WITH ALL FAULTS”, and hereby disclaim all warranties and conditions, either express, implied or statutory, including, but not limited to, any (if any) implied warranties or conditions of merchantability, of fitness for a particular purpose, of non-infringement, of lack of viruses, of accuracy or completeness of responses, of results, of ability to achieve a particular result, of ability to execute uninterrupted or error-free, and of lack of negligence or lack of workmanlike effort, all with regard to the SOFTWARE PRODUCT, and the provision of or failure to provide Support Services. THE ENTIRE RISK AS TO THE QUALITY OF OR ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE PRODUCT AND SUPPORT SERVICES, IF ANY, REMAINS WITH YOU.
Specifically, and without limiting the foregoing, you acknowledge that Nuts About Nets, LLC has not made any representations or warranties with respect to the SOFTWARE PRODUCT or the functionality thereof and has made no representations or warranties with respect thereto. In addition, you acknowledge that you have selected the SOFTWARE PRODUCT, and that Nuts About Nets, LLC makes no representations or warranties with respect to the fitness of the SOFTWARE PRODUCT for any purpose.
6. NO SUPPORT
Nothing in this EULA shall obligate Nuts About Nets, LLC to provide any support for the SOFTWARE PRODUCT. Nuts About Nets, LLC may, but shall be under no obligation to, correct any defects in the SOFTWARE PRODUCT and/or provide updates to You of the SOFTWARE PRODUCT. You shall promptly report to Nuts About Nets, LLC any defects You find in the SOFTWARE PRODUCT to aid Nuts About Nets, LLC in creating improved revisions of such items.
7. EXCLUSION OF INCIDENTAL, CONSEQUENTIAL AND CERTAIN OTHER DAMAGES.
To the maximum extent permitted by applicable law, in no event shall Nuts About Nets, LLC or its suppliers be liable under any theory of liability for any special, incidental, indirect, or consequential damages whatsoever (including, but not limited to, damages for loss of profits or confidential or other information, for business interruption, for personal injury, for loss of privacy, for failure to meet any duty including of good faith or of reasonable care, for negligence, and for any other pecuniary or other loss whatsoever) arising out of or in any way related to the use of or inability to use the SOFTWARE PRODUCT, the provision of or failure to provide support services, or otherwise under or in connection with any provision of this EULA, even in the event of the fault, tort (including negligence), strict liability, breach of contract or breach of warranty of Nuts About Nets, LLC or any supplier, and even if Nuts About Nets, LLC or any supplier has been advised or should know of the possibility of such damages.
8. LIMITATION OF LIABILITY AND REMEDIES.
Notwithstanding anything to the contrary contained in this EULA, and without limiting any other rights, remedies, limitations, or restrictions in this EULA or under law, Nuts About Nets, LLC will not be liable with respect to any subject matter of this EULA under any contract, negligence, strict liability, or other theory, at law or in equity, for any amounts aggregating in excess of amounts paid to it under this agreement in the twelve (12) month period before the cause of action arose.
You hereby agree to indemnify, protect, defend and hold Nuts About Nets, LLC harmless from and against any and all claims, losses and damages, including without limitation, reasonable attorneys’ and experts’ fees and disbursements, (a) which may at any time be asserted against Nuts About Nets, LLC by any party for Your failure to perform any of the covenants, agreements, terms, provisions or conditions contained in this EULA, (b) by any party by reason of Your use or misuse of the SOFTWARE PRODUCT, or (c) resulting from any failure by You to comply with any term or condition of this EULA. The provisions of this Section 10 shall survive the expiration or earlier termination of the EULA.
10. ENTIRE AGREEMENT.
This EULA (including any addendum or amendment to this EULA which is included with the SOFTWARE PRODUCT) is the entire agreement between you and Nuts About Nets, LLC relating to the SOFTWARE PRODUCT and the Support Services (if any or many) and it supersedes all prior or contemporaneous oral or written communications, proposals and representations with respect to the SOFTWARE PRODUCT or any other subject matter covered by this EULA. To the extent the terms of any Nuts About Nets, LLC policies or programs for Support Services conflict with the terms of this EULA, the terms of this EULA shall control.
If any provision of this EULA shall be or become invalid, illegal, or unenforceable in any respect, the validity, legality, and enforceability of the remaining provisions contained herein shall not be affected thereby. No failure or delay in exercising any right or remedy shall operate as a waiver of any such (or any other) right or remedy. Any modification or waiver to this EULA must be in writing and signed by both parties. The language of this EULA shall be construed as a whole, according to its fair meaning and intent, and not strictly for or against either party, regardless of who drafted or was principally responsible for drafting this EULA or any specific term or conditions hereof.
Nothing in this EULA shall be deemed to create any type of agency, joint venture, or partnership relationship between the parties. Neither party shall have any right or authority to bind or obligate the other in any manner to any third party. In the event of any legal proceeding between the parties arising out of or related to this EULA, the prevailing party shall be entitled to recover, in addition to any other relief awarded or granted, its costs and expenses (including reasonable attorneys’ and expert witness’ fees) incurred in any such proceeding.