4 FolderToTaskCsv
Niquel Mendoza редактировал(а) эту страницу 2026-04-30 19:06:29 +00:00

Utils / FolderTaskToCSV

A set of experts that iterate over a folder of .set files, modify the data generation parameter in each one and produce a CSV file with the resulting backtesting tasks.

Each variant differs in how the input folder is organised and where the timeframe for each task is obtained.


FolderTaskToCSV

Basic variant. Expects one level of subfolders per symbol. The timeframe is read directly from the content of each .set.

Expected folder structure

InpFolder/
├── EURUSD/
│   ├── config_a.set
│   └── config_b.set
└── GBPUSD/
    └── config_c.set
  • Level 1 — folder named after the symbol (e.g. EURUSD)
  • Level 2.set files ready for the Strategy Tester

Input parameters

Parameter Type Description
InpFolder string Relative path to the root folder containing the symbol subfolders. Must end in \.
InpFolderIsInCommon bool true to resolve the path from the terminal Common folder. false to resolve from the terminal Data folder.
InpParamTimeframeName string Exact name of the parameter inside the .set from which the timeframe is read (e.g. InpTimeframe).
InpParamActiveGenerateName string Exact name of the parameter inside the .set that activates data generation (e.g. InpGenerateMode). The expert overwrites it to true in each file.
InpDataStartDate datetime Start date of the data range for all tasks. 0 for no limit.
InpDataEndDate datetime End date of the data range for all tasks. 0 for no limit.
InpCsvFileNameOutput string Output CSV file name (e.g. task.csv).
InpCsvFileNameOutputIsInCommon bool true to save the CSV in the Common folder. false to save it in the Data folder.
InpStrMatchExcluyed string Strings separated by ... to define file extensions/names that will be excluded from the task creation process
InpStrMatchIncluyed string Strings separated by .. to define file extensions/names that will be included in the task creation process

Note por separator: "..." = "|", check https://forge.mql5.io/nique_372/MQLArticles/src/branch/main/Utils/StrMatch/README.md for mos examples of use por "strings" for define incluyed\excluyed >extensions and files

Behaviour

  1. Iterates InpFolder looking for symbol subfolders.
  2. Inside each symbol, processes the .set files found directly.
  3. For each .set, reads the value of the InpParamTimeframeName parameter to get the timeframe.
  4. Overwrites the InpParamActiveGenerateName parameter to true directly in the file (to activate data generation).
  5. Builds a task with the symbol, the read timeframe and the path to the .set.
  6. Saves all tasks to the CSV indicated by InpCsvFileNameOutput.
  7. Returns INIT_FAILED intentionally to unload itself automatically when done.

Notes

  • Subfolders deeper than 1 level are not processed. Any additional folder is skipped with a log warning.
  • If the InpParamTimeframeName or InpParamActiveGenerateName parameter is not found in a .set, that file is skipped and a warning is logged.

FolderTaskToCSV2

Extended variant. Adds an intermediate level of subfolders per timeframe. The timeframe is inferred from the folder name, not from the .set content.

Expected folder structure

InpFolder/
├── EURUSD/
│   ├── M1/
│   │   ├── config_a.set
│   │   └── config_b.set
│   └── H4/
│       └── config_c.set
└── GBPUSD/
    └── D1/
        └── config_d.set
  • Level 1 — folder named after the symbol (e.g. EURUSD)
  • Level 2 — folder named after the timeframe (e.g. M1, H4, D1)
  • Level 3.set files ready for the Strategy Tester

Input parameters

Parameter Type Description
InpFolder string Relative path to the root folder containing the symbol subfolders. Must end in \.
InpFolderIsInCommon bool true to resolve the path from the terminal Common folder. false to resolve from the terminal Data folder.
InpParamActiveGenerateName string Exact name of the parameter inside the .set that activates data generation (e.g. InpGenerateMode). The expert overwrites it to true in each file.
InpDataStartDate datetime Start date of the data range for all tasks. 0 for no limit.
InpDataEndDate datetime End date of the data range for all tasks. 0 for no limit.
InpCsvFileNameOutput string Output CSV file name (e.g. task.csv).
InpCsvFileNameOutputIsInCommon bool true to save the CSV in the Common folder. false to save it in the Data folder.
InpStrMatchExcluyed string Strings separated by ... to define file extensions/names that will be excluded from the task creation process
InpStrMatchIncluyed string Strings separated by .. to define file extensions/names that will be included in the task creation process

Note por separator: "..." = "|", check https://forge.mql5.io/nique_372/MQLArticles/src/branch/main/Utils/StrMatch/README.md for mos examples of use por "strings" for define incluyed\excluyed >extensions and files

Behaviour

  1. Iterates InpFolder looking for symbol subfolders.
  2. Inside each symbol, iterates the timeframe subfolders.
  3. For each .set, overwrites the InpParamActiveGenerateName parameter to true directly in the file.
  4. Builds a task with the symbol, the timeframe read from the folder name and the path to the .set.
  5. Saves all tasks to the CSV indicated by InpCsvFileNameOutput.
  6. Returns INIT_FAILED intentionally to unload itself automatically when done.

Notes

  • Subfolders deeper than 2 levels are not processed. Any additional folder is skipped with a log warning.
  • Timeframe folder names must match the formats recognised by StrShortTimeframeToEnumNoRef (e.g. M1, M5, M15, M30, H1, H4, H6, H8, H12, D1, W1, MN). Any unrecognised name is interpreted as PERIOD_CURRENT.

Common notes

  • The .set files folder must be copied as-is to the terminal's Profiles\Tester\ so the Strategy Tester can locate them correctly.
  • Both experts modify the .set files on disk during execution. It is recommended to work on a copy if the original state needs to be preserved.