The speed of execution of our orders is crucial in trading whatever the type of trading we use. This guide explains how to measure your latency to your broker's server in different operating systems.
Network latency  in a packet-switched network is measured either one-way (the time from the source sending a packet to the destination receiving it), or round-trip (the one-way latency from source to destination plus the one-way latency from the destination back to the source).
We will learn how to measure the latency or time needed by our orders to reach the broker's server. We want to minimize this time, or eventually choosing a nearest server or broker if possible.
The proposed solution is a 3 step method.
- Know your broker's IP
- Determine reachability of the IP
- Measure the latency
Step 1: Know your broker's server IP
1.1 Start Button -> Run
1.2 Type cmd and press OK
1.3 The previous command will open the MS-DOS console. Close all your network programs at this point.
1.4 Type netstat and note the connections you see. These are the remaining open connections that we didn't close in the previous step.
1.5 Open your platform (JForex, Metatrader, ...) and type netstat again. You will get a new connection with a new IP address. This address is the broker's server IP. We will call it BROKER_IP.
Step 2: Verify reachability of the BROKER_IP
In this step we will discover if the server is behind a firewall or not.
2.1 Type in the console ping BROKER_IP. Wait some seconds and press Ctrl + C to stop. If you don't get the message Request Timed Out go to step 3. If you get the message, the broker is behind a firewall and we can't use the BROKER_IP to measure the latency. Instead, we will use the last IP of the tracert BROKER_IP command as shown in the images:
We use in the next step the IP previous to the Request timed out message. In the example, 22.214.171.124. We will call it LAST_IP.
Step 3: Measure the Latency
If the server wasn't behind a firewall, type in the console ping -t BROKER_IP. If it was behind a firewall, type ping -t LAST_IP. Wait some minutes and press Ctrl + C to stop the command. Your average latency is displayed:
In our example, the Average is 4 milliseconds.
UNIX BASED SYSTEMS (MAC, LINUX, ...)
The steps are exactly the same with minor changes. Just open the terminal (image below corresponds to the Ubuntu terminal):
In the step two, replace the command tracert by the command traceroute. If your system does not have the traceroute tools installed, you will need to install according to your system. In linux systems based on Debian (Debian, Ubuntu, ...) type the following command:
sudo apt-get install traceroute
We have learned how to measure the time that our orders need to reach the broker's server. We can now compare different servers from different providers. Less time implies better priority in the queues, better performance in our strategies and less risk.
The latency depends on our connection, our bandwidth, the applications that are using an internet connection, and our operating system among others.
Do your tests and public your results in the comments below. We will all contrast our results regarding our countries and platforms.