Job finished
Specification
Objective:
To develop a robust and efficient MQL5 Expert Advisor for reliable local trade copying between two MetaTrader 5 terminals on the same VPS, including features for trade direction inversion, dynamic stop-loss/take-profit recalculation, licensing, and a simple graphical user interface (GUI).
Key Features:
-
Reliable Trade Copying:
-
Real-time Signal Reception: Accurately and promptly receive trade signals (open, close, modify) from a designated sender EA.
-
Order Execution: Execute corresponding orders (market orders, pending orders) on the receiver terminal with minimal slippage and latency.
-
Order Modification Handling: Seamlessly handle order modifications (stop-loss, take-profit) received from the sender. If partial closes can be supported great, but not strictly necessary.
-
Error Handling and Recovery: Implement robust error handling mechanisms to address potential issues like order execution failures and network connectivity problems.
-
Multi-Instance Support:
-
Magic Number Differentiation: Enable running multiple instances of the receiver EA on the same VPS, each uniquely identified by a distinct magic number. This allows for simultaneous copying of signals from multiple senders or for managing multiple trading accounts with different parameters.
-
Dynamic Lot Size Calculation:
-
Formula-Based Calculation: Implement a flexible system to calculate the receiver's lot size based on a user-defined formula.
-
Input Parameters: Allow for the inclusion of various input parameters from both sender and receiver sides, such as:
-
Sender: StartingBalance, CurrentBalance/Equity, max drawdown, target profit
-
Receiver: StartingBalance, CurrentBalance/Equity, target profit,
-
Example Formula:
ReceiverLotSize = SenderLotSize * ReceiverBalance / SenderBalance -
Trade Direction Inversion:
-
Option to Invert: Provide an option to invert the trade direction of the copied signals (e.g., buy signals become sell signals and vice versa).
-
SL/TP Adjustment: If direction is inverted, adjust stop-loss and take-profit levels accordingly.
-
Dynamic SL/TP Recalculation:
-
Recalculation Logic: Implement logic to recalculate stop-loss and take-profit levels for the receiver based on the sender's initial inputs (e.g., max drawdown, target profit) and current SL/TP prices.
-
Flexibility: Allow for customization of the SL/TP recalculation logic to suit different trading strategies.
-
Symbol Mapping:
-
Flexible Mapping: Allow for flexible mapping of symbols between the sender and receiver terminals. This is crucial when dealing with different brokers or trading platforms that use different symbol names for the same underlying asset.
-
Licensing:
-
To be discussed - ideally a website with MT5 account number to validate the EA just for that specific account (as a follow-up project), an expiry date in the source code does suffice for now
-
Simple GUI:
-
Key Data Display: Display key information within the MetaTrader 5 terminal, such as:
-
Connection status to the sender (connected/disconnected)
-
Sender/Receiver Progress relative to Targets
-
Manual Trade Detection:
-
Identify Manual Trades: Implement logic to detect trades opened or closed manually on the receiver terminal.
-
Logging: Log all manual trade actions for record-keeping.
-
Restart Resilience:
-
State Preservation: Ensure that the EA can recover its operational state (e.g., connection status, trade positions, internal variables) after an unexpected MT5 restart.
-
Automatic Reinitialization: Implement logic to automatically re-establish connections, re-subscribe to necessary data feeds, and resume normal operation following an MT5 restart.
Technical Requirements:
-
MQL5 Language Proficiency: Strong understanding of MQL5 programming language, including object-oriented programming concepts.
-
MetaTrader 5 API: Familiarity with the MetaTrader 5 API for interacting with the trading platform.
-
VPS Environment: Knowledge of VPS environments and their limitations.
-
Testing and Debugging: Rigorous backtesting and forward testing to ensure the EA's stability and reliability.
Deliverables:
-
Fully Functional EA: A well-documented and commented MQL5 source code for the trade copier EA.
-
Example Configuration Files: Sample configuration files with example formulas and symbol mappings.
Note:
-
This job/task description provides a general framework. The specific requirements and features may need to be adjusted based on the client's individual needs and preferences.
-
Thorough testing and optimization are crucial to ensure the EA's stability and profitability.
-
We do have a almost fully functioning version, but cant seem to get rid of a bug that opens multiple positions on the receiver side. Debugging the sourcecode is also possible, althought it is not the most well documented sourcecode.