Create and Test Forex Strategies
Express Generator generates new collections by default. However, it has an important function to load and validate previously created collections.
We set the application to “Validator” mode by setting one or multiple collections for input.
The main parameter for setting Express Generator to load on or multiple collections is the input
parameter.
The input
parameter accepts a relative path to one or multiple collection files or a directory with collections.
We can set the path with or without the holding .\collections
directory.
We can also skip the .json
file extension.
All the following examples will load the my-collection.json
collection file. Express Generator will calculate the imported strategies according to the rules and output a new collection file as specified in the output
parameter.
input = .\collections\my-collection.json input = .\collections\my-collection input = my-collection.json input = my-collection ; imports .\collections\my-collection.json
When Express Generator imports collections, it shows the total number of strategies. By default, it calculates all strategies and stops.
Note: The provided termination rules are active. If you import a lot of strategies or use the Optimizer or the Monte Carlo validator, please consider increasing the default 3 minutes working time. You can do it by settings a larger number of minutes to the max-working-minutes
parameter.
Example:
node .\bin\gen.js --input my-collection-with-100-strategies
The above screenshot shows that Express Generator loaded 100 strategies.
It runs in a “Validator” mode. That's why we call it “Validator”. The application shows “Validating strategies: 100”.
When the Validator is ready, it shows that 89 out of 100 strategies passed the criteria on the new data.
We may give more than one collection path to the input parameter.
The following example will load three collection files for validation.
node .\bin\gen.js --input collection-one collection-two collection-three --max-working-minutes 0 ...
Another way to load multiple collections is to use a collection directory.
Here we load all the collections from the .\collections
directory.
node .\bin\gen.js --input .\collections
The input parameter accepts placeholders as follows:
[SERVER] - the data server [SYMBOL] - the data symbol [PERIOD] - the data period [YEAR] - the data update time year [MONTH] - the data update time month [DAY] - the data update time day
The placeholders will be replaced with the real values upon loading.
Here we use a placeholder to load a collection from sub-directories.
server = MyBroker symbol = GBPUSD period = H1 input = [SERVER]\[SYMBOL]\[PERIOD]\my-collection ; loaded .\collections\MyBroker\GBPUSD\H1\my-collection.json
We can select only particular collections from a directory using the input-match
parameter.
Let's have many collections in the “.\collections” directory and want to load only the ones on EURUSD. We can do it by using a matching word. Express Generator will load only the collections with “EURUSD” in its path.
node .\bin\gen.js --input .\collections --input-match EURUSD ...
Example for cross-validation: load collections from AUDUSD and validate on NZDUSD
symbol = NZDUSD period = M30 input = .\collections input-match = AUDNZD
We can use multiple matching phrases:
node .\bin\gen.js --input .\collections --input-match GBPUSD H1 ...
Express Generator will load only those collections with “GBPUSD” and “H1” in their file path.
When multiple phrases are used, the collection path must contain all of them.
We can also use placeholders such as [SERVER], [SYMBOL], [PERIOD], [YEAR], [MONTH], and [DAY] to match the corresponding data.
symbol = AUDNZD period = H1 input = .\collections input-match = [SYMBOL] [PERIOD]
In the above example, the Express Generator loads only the collections with “AUDNZD” and “H1” in their file path.
It is possible to set Express Generator to validate collections and then to continue generating new strategies.
This is done by settings the validate_then_generate
option to true
.
This example loads a collection for validation and then continues generating new strategies.
node .\bin\gen.js --input my-collection --validate-then-generate true
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Input collection or directory ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Points one or several collections or a collection directory for validation. ; Keep empty to generate a new Collection. ; Possible placeholders: [SERVER], [SYMBOL], [PERIOD], [YEAR], [MONTH], [DAY] input = ; Filters the input collections by given text phrases. ; It is helpful when we have an "input" directory with many collections. ; Possible placeholders: [SERVER], [SYMBOL], [PERIOD], [YEAR], [MONTH], [DAY] input_match = ; It validates the "input" strategies and then continues generating new ones validate_then_generate = false