MT4 Java Realtime quotes

easy direct connection to any MT4 and MT5 server

MT4 Java Realtime quotes

Here we show to subscribe to symbol and how to shutdown all threads.

 1 void subscribe() throws IOException {
 2     String symbol = "EURUSD";
 3     QuoteClient qc = new QuoteClient(2090221607, "OJgYhOfEF8", "demo.mt4tickmill.com", 443);
 4     qc.OnQuote.addListener(new OnQuote());
 5     qc.Connect();
 6     System.out.println("Connected");
 7     qc.Subscribe(symbol);
 8     System.out.println("Press enter to exit...");
 9     System.in.read();
10     qc.Disconnect();
11     ThreadPool.Executor.shutdown();
12 }
13 
14 class OnQuote implements QuoteEventHandler
15 {
16     @Override
17     public void invoke(Object sender, QuoteEventArgs args)
18     {
19         System.out.println(args);
20     }
21 }

Leave a Reply