4 Wf_File
nique_372 редактировал(а) эту страницу 2026-04-19 11:21:55 -05:00

File Module

This module contains all workflow steps that interact with the file system.

Step: File\WriteInFile

Writes text content to a file. If the file does not exist, it creates it. Supports open flags to control the write mode and format.

Structure

- name: "WriteInFile"
  module: "File"
  with:
    file_name: "results.csv"
    content: "date,value\n2026-01-01,100"
    open_flags: ["FILE_COMMON", "FILE_TXT"]

Parameters

Parameter Required Description
file_name Yes Destination file name. Located in the MQL5 files folder
content Yes Text to write to the file.
open_flags No List of additional open flags. Combined with FILE_WRITE. All MT5 flags are available: FILE_COMMON, FILE_ANSI, etc

Note: The FILE_WRITE flag is always applied automatically. Flags declared in open_flags are added via bitwise OR on top of that base value.


Step: File\FileDelete

Deletes a file from the file system. If the file does not exist or cannot be deleted, the step fails and returns the GetLastError() error code.

Structure

- name: "FileDelete"
  module: "File"
  with:
    file_name: "results.csv"
    common_flag: true

Parameters

Parameter Required Description
file_name Yes File name to delete. Path relative to the MQL5 files folder
common_flag No If true the file is looked up in the Common folder. Default: false

Note: If the file does not exist the step will fail.