extract_function
Extract a block of MQL4/MQL5 source lines into a new helper function, detecting parameters and call site. Use dry-run to preview changes before applying.
Instructions
Extract a contiguous block of lines into a new helper function.
Brace-counting + regex param detection — not a full AST parser. Returns the
proposed helper, call site, and parameter list. Set dry_run=False to write.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| source | Yes | Absolute Windows path to the .mq4/.mq5/.mqh source file. | |
| dry_run | No | true = preview the change and write nothing; false = apply it to the files. | |
| line_end | Yes | Last line (1-based, inclusive) of the block to extract. | |
| new_name | Yes | Name of the new helper function. | |
| line_start | Yes | First line (1-based, inclusive) of the block to extract. | |
| return_type | No | Return type of the helper, e.g. void or double. | void |
| target_file | No | Optional .mqh path to append the helper to; defaults to inserting above the enclosing function. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||