agentleFS
kecoma1kecoma1/MQL5-SKILLS/skills/interface/SKILL.md

interface

Skill17 starsChanged 7 months agoMITView on GitHub

Use the local MetaTrader 5 Python trading CLI at MQL5\Scripts\interface.py. Use when Codex needs to explain, run, validate, or troubleshoot command-line trading operations such as opening market or pending orders, setting or editing SL/TP, closing positions, canceling pending orders, listing opened trades or pending orders, reading recent trade history, or checking account and symbol details.

  • Installs packages

4 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

19 rules. 0 are common, 6 are distinctive, and 13 are very specific to this project.

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 6

    Distinctive

    This author's own choices. Worth a look.

  • 13

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill for the local MT5 Python CLI wrapper located at:

    line 8
  2. Very specific:

    Read recent history. The misspelled alias hystory is accepted for compatibility:

    line 93
  3. Distinctive:

    Check account or symbol details:

    line 100
  4. Very specific:

    Use --SL and --TP for absolute prices only.

    line 109
  5. Distinctive:

    Use distance parameters when the user describes stops in points or pips:

    line 111
  6. Very specific:

    Use --price for pending order entry price.

    line 118
  7. Very specific:

    Use --stoplimit for buystoplimit and sellstoplimit orders.

    line 120
  8. Very specific:

    Use --lot or --volume for trade volume.

    line 122
  9. Very specific:

    Use --deviation for allowed slippage in points on market entries and closes.

    line 124
  10. Very specific:

    Use --filling when the broker rejects the default filling mode.

    line 126
  11. Very specific:

    Use --json when another script needs machine-readable output.

    line 128
  12. Distinctive:

    Before sending live-trading commands, restate the exact operation in concrete terms: command, symbol, type, volume, price if pending, SL, …

    line 132
  13. Very specific:

    If the user provides ambiguous stops like SL=23, ask whether they mean an absolute price, points, or pips before executing.

    line 134
  14. Very specific:

    If the user asks only how to do something, provide commands and avoid running them.

    line 136
  15. Very specific:

    If MT5 returns a non-success retcode, report the retcode, retcode_name, and comment.

    line 138
  16. Distinctive:

    If Python hangs or does not print output, inspect the executable:

    line 142
  17. Very specific:

    If MetaTrader5 cannot import, install it into the Python interpreter that will run interface.py.

    line 149
  18. Distinctive:

    If MT5 cannot initialize, make sure the terminal is open or pass the full path:

    line 151
  19. Very specific:

    If closing by --id fails because the ticket is not an open position, check pending orders with --cmd=orders.

    line 157

“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Interface

Use this skill for the local MT5 Python CLI wrapper located at:

C:\Users\kecom\AppData\Roaming\MetaQuotes\Terminal\D0E8209F77C8CF37AD8BF550E51FF075\MQL5\Scripts\interface.py

The script is intended to operate MetaTrader 5 through the Python MetaTrader5 package. Treat it as a live-trading interface: do not submit market, pending, close, edit, or cancel commands unless the user explicitly asked for that action and the target account/symbol/ticket/volume/stops are clear.

Before Running

  1. Work from the script directory unless there is a reason not to:
cd C:\Users\kecom\AppData\Roaming\MetaQuotes\Terminal\D0E8209F77C8CF37AD8BF550E51FF075\MQL5\Scripts
  1. Confirm a real Python executable is available. If python resolves to C:\Users\kecom\AppData\Local\Microsoft\WindowsApps\python.exe, it may hang or open the Microsoft Store alias instead of running scripts.
  2. Confirm the package is installed when execution is required:
python -m pip install MetaTrader5
  1. Confirm MetaTrader 5 is installed, logged in, and allowed to trade. If needed, pass --terminal, --login, --password, and --server.
  2. For read-only inspection, prefer --cmd=help, --cmd=opened, --cmd=orders, --cmd=history, --cmd=account, and --cmd=symbol.

Core Commands

Show the built-in help:

python interface.py --cmd=help

Open a market buy using SL/TP distances in points:

python interface.py --cmd=open --type=buy --market=EURUSD --lot=0.10 --sl-points=200 --tp-points=400

Open a pending buy limit using absolute SL/TP prices:

python interface.py --cmd=open --type=buylimit --market=EURUSD --lot=0.10 --price=1.08000 --SL=1.07500 --TP=1.09000

Close one open position by ticket:

python interface.py --cmd=close --id=322334

Close all positions, optionally filtered by market:

python interface.py --cmd=close --all --market=EURUSD

Edit SL/TP on an open position or pending order:

python interface.py --cmd=edit --id=23232 --TP=1.09250
python interface.py --cmd=edit --id=23232 --sl-points=150 --tp-points=300

Cancel a pending order:

python interface.py --cmd=cancel --id=998877

List current positions:

python interface.py --cmd=opened
python interface.py --cmd=opened --market=EURUSD

List pending orders:

python interface.py --cmd=orders
python interface.py --cmd=orders --market=EURUSD

Read recent history. The misspelled alias hystory is accepted for compatibility:

python interface.py --cmd=history --last=10
python interface.py --cmd=hystory --last=10 --market=EURUSD

Check account or symbol details:

python interface.py --cmd=account
python interface.py --cmd=symbol --market=EURUSD

Parameter Rules

Use --SL and --TP for absolute prices only. Example: --SL=1.07500, not --SL=23 unless 23 is truly the broker price.

Use distance parameters when the user describes stops in points or pips:

--sl-points=200 --tp-points=400
--sl-pips=20 --tp-pips=40

Use --price for pending order entry price. Market orders can omit --price; the script uses the current ask for buys and bid for sells.

Use --stoplimit for buystoplimit and sellstoplimit orders.

Use --lot or --volume for trade volume.

Use --deviation for allowed slippage in points on market entries and closes.

Use --filling when the broker rejects the default filling mode. Valid values are ioc, fok, return, and boc.

Use --json when another script needs machine-readable output. Use --dry-run to build and print an MT5 trade request without sending it to the broker.

Safety Workflow

Before sending live-trading commands, restate the exact operation in concrete terms: command, symbol, type, volume, price if pending, SL, TP, ticket if applicable, and whether values are absolute prices or distances.

If the user provides ambiguous stops like SL=23, ask whether they mean an absolute price, points, or pips before executing. Do not convert ambiguous stop values silently.

If the user asks only how to do something, provide commands and avoid running them. If testing an order workflow, use --dry-run first.

If MT5 returns a non-success retcode, report the retcode, retcode_name, and comment. Suggest the smallest relevant next check, such as symbol visibility, filling mode, invalid stops, market closed, insufficient margin, or wrong ticket type.

Common Troubleshooting

If Python hangs or does not print output, inspect the executable:

where.exe python
Get-Command python | Select-Object Source,CommandType

If MetaTrader5 cannot import, install it into the Python interpreter that will run interface.py.

If MT5 cannot initialize, make sure the terminal is open or pass the full path:

python interface.py --cmd=account --terminal "C:\Path\To\terminal64.exe"

If closing by --id fails because the ticket is not an open position, check pending orders with --cmd=orders; pending orders are removed with --cmd=cancel.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.