Create and Test Forex Strategies
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| express-generator:mm-js [2026/02/22 09:56] – [Parameters] Miroslav Popov | express-generator:mm-js [2026/05/29 10:23] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Multi-Market (mm.js) ====== | ====== Multi-Market (mm.js) ====== | ||
| - | The Multi-Market script | + | The Multi-Market script |
| + | It combines two core capabilities: | ||
| + | |||
| + | * data fetching from the Fetcher workflow | ||
| + | * strategy validation from the Generator validator workflow | ||
| + | |||
| + | If you are new to ExGen workflows, begin with [[quick-start|Quick Start]] before configuring Multi-Market runs. | ||
| + | |||
| + | ===== How it works ===== | ||
| + | |||
| + | Multi-Market runs this pipeline: | ||
| + | |||
| + | * loads settings from '' | ||
| + | * resolves test markets from '' | ||
| + | * fetches required data files for each test market | ||
| + | * validates each input strategy on each test market | ||
| + | * counts passed tests per strategy and exports only those that meet '' | ||
| + | |||
| + | ===== Requirements ===== | ||
| + | |||
| + | * Input collection must be provided via '' | ||
| + | * Symbol info files must exist for all test servers in '' | ||
| + | * '' | ||
| + | * Both '' | ||
| + | * You can prepare symbol info with Fetcher, for example: '' | ||
| ===== Quick start ===== | ===== Quick start ===== | ||
| - | Validate a collection against 8 markets and export | + | Validate a collection against 8 test markets and export strategies that pass at least 5 tests. |
| Command: | Command: | ||
| express-generator> | express-generator> | ||
| + | |||
| + | |||
| + | Run with a custom settings file and CLI override: | ||
| + | |||
| + | express-generator> | ||
| Output fetch: | Output fetch: | ||
| - | | + | <code text> |
| + | ..:: Express Generator Multi Market v2.xx ::.. | ||
| Fetched: Premium Data EURUSD M30, From: 2018-02-13 20:30, To: 2026-02-20 22:00, Bars: 100000 | Fetched: Premium Data EURUSD M30, From: 2018-02-13 20:30, To: 2026-02-20 22:00, Bars: 100000 | ||
| Line 24: | Line 54: | ||
| Fetched: Premium Data EURCHF M30, From: 2018-02-13 07:30, To: 2026-02-20 22:00, Bars: 100000 | Fetched: Premium Data EURCHF M30, From: 2018-02-13 07:30, To: 2026-02-20 22:00, Bars: 100000 | ||
| Fetched: Premium Data EURJPY M30, From: 2018-02-13 14:30, To: 2026-02-20 22:00, Bars: 100000 | Fetched: Premium Data EURJPY M30, From: 2018-02-13 14:30, To: 2026-02-20 22:00, Bars: 100000 | ||
| + | </ | ||
| Output validation: | Output validation: | ||
| + | <code text> | ||
| ... | ... | ||
| Market : Premium Data NZDUSD M30 | Market : Premium Data NZDUSD M30 | ||
| Line 32: | Line 64: | ||
| Spread : 10, Swap long: -4.16, Swap short: -4.16, Commission: 6 USD | Spread : 10, Swap long: -4.16, Swap short: -4.16, Commission: 6 USD | ||
| Account: 10000 USD, Leverage: 100, Entry: 0.01 lots | Account: 10000 USD, Leverage: 100, Entry: 0.01 lots | ||
| - | | + | |
| - | - Passed: 12, Calculated: 100 of 100 | + | - Passed: 12, Calculated: 100 of 100 |
| - | + | ||
| Market : Premium Data EURGBP M30 | Market : Premium Data EURGBP M30 | ||
| From : 2018-02-13 17:00, To: 2026-02-20 22:00, Bars: 100000 | From : 2018-02-13 17:00, To: 2026-02-20 22:00, Bars: 100000 | ||
| Line 40: | Line 72: | ||
| Account: 10000 USD, Leverage: 100, Entry: 0.01 lots | Account: 10000 USD, Leverage: 100, Entry: 0.01 lots | ||
| ... | ... | ||
| + | </ | ||
| Output stats and collection: | Output stats and collection: | ||
| - | | + | <code text> |
| - | + | Multi-Market validator ready! | |
| - | 34 of 100 strategies passed | + | |
| - | 43 of 100 strategies passed | + | |
| - | 15 of 100 strategies passed | + | |
| - | 3 of 100 strategies passed | + | |
| - | 5 of 100 strategies passed | + | |
| - | + | ||
| - | Count of strategies: 5 | + | |
| - | Collection exported: collections/ | + | |
| - | ===== Settings Files ===== | + | 34 of 100 strategies passed |
| - | + | 43 of 100 strategies passed | |
| - | The Multi-Market script **./ | + | 15 of 100 strategies passed |
| - | + | 3 of 100 strategies passed | |
| - | **mm.js** always loads the default settings file. Then we specify the parameters with custom settings files or CLI parameter. | + | 5 of 100 strategies passed |
| - | + | ||
| - | Here we load custom settings file '' | + | |
| - | + | ||
| - | node ./bin/mm.js --settings mm.ini --symbol GBPUSD | + | |
| - | + | ||
| - | We can give several settings files. The later overrides the previous one. | + | |
| - | + | ||
| - | node ./bin/mm.js --settings mm.ini gbpusd.ini | + | |
| - | + | ||
| - | + | ||
| - | ===== Parameters ===== | + | |
| - | + | ||
| - | The Multi-Market needs several groups | + | |
| - | + | ||
| - | + | ||
| - | ==== Input Data set ==== | + | |
| - | + | ||
| - | <code ini> | + | |
| - | ; These perameters serve to resoleve the input collection placeholders | + | |
| - | + | ||
| - | ; Server: Premium, Eightcap, BlackBull, Darwinex, MetaQuotes | + | |
| - | server = Premium | + | |
| - | + | ||
| - | ; The symbol | + | |
| - | symbol = EURUSD | + | |
| - | + | ||
| - | ; Timeframe to download and use. | + | |
| - | ; Available values: M1 M5 M15 M30 H1 H4 D1 | + | |
| - | period = M30 | + | |
| + | Count of strategies: 5 | ||
| + | Collection exported: collections/ | ||
| </ | </ | ||
| + | ===== Settings and priority ===== | ||
| - | ==== Input collection | + | Multi-Market reads settings in this order (lowest to highest priority): |
| - | < | + | * default settings file: '' |
| - | ; Points to one or more collections, | + | * user settings file(s): '' |
| - | ; Possible placeholders: [SERVER], [SYMBOL], [PERIOD], [YEAR], [MONTH], [DAY] | + | * CLI options: for example '' |
| - | input = Coll_[SERVER]_[SYMBOL]_[PERIOD].json | + | |
| - | ; Filters the input collections by given text phrases. | + | Settings keys can be in snake case, camel case, or pascal case. |
| - | ; Useful when the " | + | |
| - | ; Possible placeholders: | + | |
| - | input_match = | + | |
| - | </ | + | |
| - | ==== Data parameters | + | When several files are passed with '' |
| - | <code ini> | + | Common aliases are accepted: |
| - | ; These parameters affect the initial data set and the fetched data | + | |
| - | ; Time zone offset in hours. UTC = 0 | + | * '' |
| - | time_zone = 0 | + | * '' |
| + | * '' | ||
| + | * '' | ||
| - | ; Cut data to maximum bars. | ||
| - | ; Set it to 0 to load all available bars | ||
| - | max_data_bars = 100000 | ||
| - | ; This option is helpful to prevent frequent downloads of data files. | + | ===== Settings topics ===== |
| - | ; It accepts time in *minutes*, where 0 means the option is off. | + | |
| - | ; Example: if_missing_or_older_than | + | |
| - | ; It downloads a new data file if the current file is missing or was not updated in the last 60 minutes. | + | |
| - | if_missing_or_older_than | + | |
| - | </ | + | |
| - | ==== Test data ==== | + | Dedicated Multi-Market pages: |
| - | <code ini> | + | * [[mm-initial-data|Initial data set]] |
| - | ; One or several servers to load and test | + | * [[mm-fetch-parameters|Fetch parameters]] |
| - | ; Valid server names: Premium, Eightcap, BlackBull, Darwinex, MetaQuotes | + | * [[mm-test-markets|Test markets]] |
| - | test_servers = Premium | + | * [[mm-tests|Multi-Market tests]] |
| - | ; One or several periods to load and test | + | Shared settings pages used by Multi-Market: |
| - | ; Valid period names: M1, M5, M15, M30, H1, H4, D1 | + | |
| - | test_periods = M15 | + | |
| - | ; The symbols to download and use for the MM validation. | + | * [[input-collection|Input collection]] |
| - | ; Example: test_symbols = EURUSD USDCHF GBPUSD USDJPY | + | * [[output-collection|Output collection]] |
| - | ; Use " | + | * [[data-horizon|Data horizon]] |
| - | test_symbols = auto | + | * [[out-of-sample|Out of sample]] |
| - | </ | + | * [[trading-session|Trading session]] |
| + | * [[account-settings|Account settings]] | ||
| + | * [[backtester|Backtester]] | ||
| + | * [[acceptance-criteria|Acceptance criteria]] | ||
| + | * [[miscellaneous|Miscellaneous]] | ||
| + | * [[settings-files|Settings files]] | ||
| - | ==== Multi-Market tests ==== | ||
| - | <code ini> | + | ===== Related scripts ===== |
| - | ; The count of the Multi Market tests to perform. | + | |
| - | count_of_tests | + | |
| - | ; The minimum count of the passed tests. | + | * [[fetch-js|Fetcher (fetch.js)]] |
| - | ; A test is considered as " | + | |
| - | ; Must be less than or equal to " | + | |
| - | min_passed_tests = 3 | + | |
| - | </ | + | |
| - | + | ||
| - | + | ||
| - | ==== Output collection ==== | + | |
| - | + | ||
| - | <code ini> | + | |
| - | ; Output collection filename for a newly generated or validated collection. | + | |
| - | ; Possible placeholders: | + | |
| - | ; Placeholders can be used as directory names too. | + | |
| - | ; Example: output = ./ | + | |
| - | output = Coll_[SERVER]_[SYMBOL]_[PERIOD]_MM.json | + | |
| - | + | ||
| - | ; When " | + | |
| - | ; When " | + | |
| - | output_replace = false | + | |
| - | </ | + | |
| - | + | ||
| - | ==== Account settings ==== | + | |
| - | + | ||
| - | <code ini> | + | |
| - | account_currency = USD | + | |
| - | initial_account | + | |
| - | leverage | + | |
| - | </ | + | |
| - | + | ||
| - | + | ||
| - | ==== Trading Session ==== | + | |
| - | + | ||
| - | <code ini> | + | |
| - | session_open | + | |
| - | session_close = 24:00 | + | |
| - | friday_close | + | |
| - | + | ||
| - | trade_on_sunday = true | + | |
| - | + | ||
| - | close_at_session_close = false | + | |
| - | close_at_friday_close | + | |
| - | </ | + | |
| - | + | ||
| - | + | ||
| - | ==== Backtester ==== | + | |
| - | + | ||
| - | <code ini> | + | |
| - | close_at_backtest_end = true | + | |
| - | </ | + | |
| - | + | ||
| - | + | ||
| - | ==== Acceptance criteria ==== | + | |
| - | + | ||
| - | <code ini> | + | |
| - | ; Set 0 to ignore a criterion | + | |
| - | max_average_pos_length = 0 | + | |
| - | max_consecutive_losses = 0 | + | |
| - | max_drawdown_percent | + | |
| - | max_equity_drawdown | + | |
| - | max_stagnation_days | + | |
| - | max_stagnation_percent = 0 | + | |
| - | min_average_pos_length = 0 | + | |
| - | min_count_of_trades | + | |
| - | min_profit | + | |
| - | min_profit_factor | + | |
| - | min_profit_per_day | + | |
| - | min_r_squared | + | |
| - | min_return_to_drawdown = 0 | + | |
| - | min_win_loss_ratio | + | |
| - | min_m1_profit | + | |
| - | min_m1_profit_factor | + | |
| - | min_m1_count_of_trades = 0 | + | |
| - | min_m3_profit | + | |
| - | min_m3_profit_factor | + | |
| - | min_m3_count_of_trades = 0 | + | |
| - | min_y1_profit | + | |
| - | min_y1_profit_factor | + | |
| - | min_y1_count_of_trades = 0 | + | |
| - | </ | + | |
| - | + | ||
| - | + | ||
| - | ==== Miscellaneous ==== | + | |
| - | + | ||
| - | <code ini> | + | |
| - | ; Prevent showing output in the console (except errors) | + | |
| - | ; This option is useful if you run mm.js from another script in the background. | + | |
| - | silent = false | + | |
| - | </ | + | |