Tâche terminée
Spécifications
📄 Job Description:
I have a validated calendar spread strategy (e.g., CCMU25 - CCMX25) for Brazilian corn futures, with logic already implemented in Python.
I now need a robust Python script (not MQL5) that connects to MetaTrader 5, handles order book depth (DOM) for both legs, and executes the spread precisely. The bot must also send status updates and position events to a Discord channel, and perform periodic checks for trading conditions.
✅ Objectives:
Build a Python bot that:
-
Connects to MetaTrader 5 (MT5).
-
Retrieves and processes the order book (DOM) for both spread legs.
-
Validates liquidity and spread thresholds before placing any order.
-
Executes coordinated trades (e.g., buy CCMU25 / sell CCMX25 – 1 lot each) only if both sides are tradable.
-
Prevents execution mismatches (avoids overexposure or “encilhamento”).
-
Monitors execution status and dynamically adjusts the second leg according to a defined trading logic:
-
If the first leg fills, modify the second leg’s order price (e.g., improve or chase) within a defined slippage limit.
-
If execution fails beyond the threshold, cancel or rollback position.
-
-
Sends key information to Discord, such as:
-
New signal detected (entry)
-
Orders sent
-
Position opened
-
Position closed
-
Errors or warnings (e.g., low liquidity)
-
-
Performs periodic checks (e.g., every X seconds/minutes) to scan for new signals and manage existing positions.
💵 Deliverables:
-
Fully functional .py script including:
-
DOM reading
-
Spread logic validation
-
Coordinated order execution
-
Execution monitoring & dynamic adjustment
-
Discord integration
-
Periodic signal scan loop
-
-
Well-documented, with examples for testing
💬 Notes:
-
I will provide the signal logic. Your focus will be execution, position management, and communication.
-
Priority is on realistic execution logic that considers order book conditions and avoids risks common in low-liquidity markets.
-
Script must run on Windows with MetaTrader 5 installed.