Create and Test Forex Strategies
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| express-generator:mm-js [2026/02/22 07:28] – created Miroslav Popov | express-generator:mm-js [2026/02/22 17:26] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 2: | Line 2: | ||
| The Multi-Market script (mm.js) validates a collection against another markets. | The Multi-Market script (mm.js) validates a collection against another markets. | ||
| + | |||
| + | ===== Quick start ===== | ||
| + | |||
| + | Validate a collection against 8 markets and export the strategies that pass 5 of 8 tests. | ||
| + | |||
| + | Command: | ||
| + | |||
| + | express-generator> | ||
| + | |||
| + | |||
| + | Output fetch: | ||
| + | |||
| + | ..:: Express Generator Multi Market v2.70 ::.. | ||
| + | |||
| + | Fetched: Premium Data EURUSD M30, From: 2018-02-13 20:30, To: 2026-02-20 22:00, Bars: 100000 | ||
| + | Fetched: Premium Data GBPUSD M30, From: 2018-02-13 07:00, To: 2026-02-20 22:00, Bars: 100000 | ||
| + | Fetched: Premium Data AUDUSD M30, From: 2018-02-13 17:00, To: 2026-02-20 22:00, Bars: 100000 | ||
| + | Fetched: Premium Data NZDUSD M30, From: 2018-02-13 07:00, To: 2026-02-20 22:00, Bars: 100000 | ||
| + | Fetched: Premium Data EURGBP M30, From: 2018-02-13 17:00, To: 2026-02-20 22:00, Bars: 100000 | ||
| + | Fetched: Premium Data EURAUD M30, From: 2018-02-13 08:00, 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 | ||
| + | |||
| + | Output validation: | ||
| + | |||
| + | ... | ||
| + | Market : Premium Data NZDUSD M30 | ||
| + | From : 2018-02-13 07:00, To: 2026-02-20 22:00, Bars: 100000 | ||
| + | Spread : 10, Swap long: -4.16, Swap short: -4.16, Commission: 6 USD | ||
| + | Account: 10000 USD, Leverage: 100, Entry: 0.01 lots | ||
| + | |||
| + | - Passed: 12, Calculated: 100 of 100 | ||
| + | |||
| + | Market : Premium Data EURGBP M30 | ||
| + | From : 2018-02-13 17:00, To: 2026-02-20 22:00, Bars: 100000 | ||
| + | Spread : 10, Swap long: -15.22, Swap short: 5.52, Commission: 6 USD | ||
| + | Account: 10000 USD, Leverage: 100, Entry: 0.01 lots | ||
| + | ... | ||
| + | |||
| + | 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 ===== | ||
| + | |||
| + | The Multi-Market script **./ | ||
| + | |||
| + | **mm.js** always loads the default settings file. Then we specify the parameters with custom settings files or CLI parameter. | ||
| + | |||
| + | 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 of parameters: | ||
| + | |||
| + | |||
| + | ==== Input Data set ==== | ||
| + | |||
| + | <code ini> | ||
| + | ; These perameters serve to resoleve the input collection placeholders | ||
| + | |||
| + | ; Server: Premium, Eightcap, BlackBull, Darwinex, MetaQuotes | ||
| + | server = Premium | ||
| + | |||
| + | ; The symbol of the original strategy | ||
| + | symbol = EURUSD | ||
| + | |||
| + | ; Timeframe to download and use. | ||
| + | ; Available values: M1 M5 M15 M30 H1 H4 D1 | ||
| + | period = M30 | ||
| + | |||
| + | </ | ||
| + | |||
| + | |||
| + | ==== Input collection | ||
| + | |||
| + | <code ini> | ||
| + | ; Points to one or more collections, | ||
| + | ; Possible placeholders: | ||
| + | input = Coll_[SERVER]_[SYMBOL]_[PERIOD].json | ||
| + | |||
| + | ; Filters the input collections by given text phrases. | ||
| + | ; Useful when the " | ||
| + | ; Possible placeholders: | ||
| + | input_match = | ||
| + | </ | ||
| + | |||
| + | ==== Data parameters | ||
| + | |||
| + | <code ini> | ||
| + | ; 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. | ||
| + | ; It accepts time in *minutes*, where 0 means the option is off. | ||
| + | ; Example: if_missing_or_older_than = 60 | ||
| + | ; 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 = 0 | ||
| + | </ | ||
| + | |||
| + | ==== Test data ==== | ||
| + | |||
| + | <code ini> | ||
| + | ; One or several servers to load and test | ||
| + | ; Valid server names: Premium, Eightcap, BlackBull, Darwinex, MetaQuotes | ||
| + | test_servers = Premium | ||
| + | |||
| + | ; One or several periods to load and test | ||
| + | ; Valid period names: M1, M5, M15, M30, H1, H4, D1 | ||
| + | test_periods = M15 | ||
| + | |||
| + | ; The symbols to download and use for the MM validation. | ||
| + | ; Example: test_symbols = EURUSD USDCHF GBPUSD USDJPY | ||
| + | ; Use " | ||
| + | test_symbols = auto | ||
| + | </ | ||
| + | |||
| + | ==== Multi-Market tests ==== | ||
| + | |||
| + | <code ini> | ||
| + | ; The count of the Multi Market tests to perform. | ||
| + | count_of_tests = 5 | ||
| + | |||
| + | ; The minimum count of the passed tests. | ||
| + | ; 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 (except " | ||
| + | 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 | ||
| + | </ | ||
| + | |||