The Client class is the primary entry point for communicating with MetaTrader 4 or 5. To instantiate it, you must provide an EventHandler to handle incoming data events, the directory path where MetaTrader is installed, and several configuration parameters for timing and reliability.
Constructor Parameters:
EventHandler eventHandler: An implementation of the EventHandler interface to receive callbacks (e.g., onTick, onOrderEvent).String MetaTraderDirPath: The local filesystem path to the MetaTrader installation directory.int sleepDelay: Delay in milliseconds between file checks.int maxRetryCommandSeconds: Maximum time in seconds to retry sending a command if the command files are currently being processed by MetaTrader.boolean loadOrdersFromFile: If true, the client will attempt to load existing orders from DWX_Orders_Stored.txt to maintain state across restarts.boolean verbose: If true, enables detailed logging to the console.
// Example initialization
EventHandler myHandler = new MyEventHandler();
Client client = new Client(myHandler, "C:/Program Files/MetaTrader 5", 100, 5, true, true);