MT4 Java Trading activity

easy direct connection to any MT4 and MT5 server

MT4 Java Trading activity

This example shows how to monitor any trading activity that happens on account.

 1 void activity() throws IOException, TimeoutException, ConnectException {
 2     QuoteClient qc = new QuoteClient(2090221607, "OJgYhOfEF8", "demo.mt4tickmill.com", 443);
 3     qc.Connect();
 4     System.out.println("Connected. Balance = " + qc.AccountBalance());
 5     qc.OnOrderUpdate.addListener(new OnUpdate());
 6     System.out.println("Open/close orders in MT4 Terminal to see events here. Press enter to exit...");
 7     System.in.read();
 8     qc.Disconnect();
 9     ThreadPool.Executor.shutdown();
10 }
11 
12 class OnUpdate implements OrderUpdateEventHandler {
13     @Override
14     public void invoke(Object sender, OrderUpdateEventArgs update) {
15         System.out.println(update.Order.Type + update.Order.Symbol);
16     }
17 }

Leave a Reply