What’s the best way to test an arbitrage trading program?

Let’s say that you have a program, an account with a broker, and you now want to test the program to make sure that your strategy will work.

It’s best to test the program in a demo account first. I understand that the trading environment in a demo account is inherently different from that in a real account, but if your results in a demo account are poor, it is highly unlikely that they will be different in a real account. Also, testing the program in a demo account will reveal any problems that may exist in your setup.

I would recommend that you do the following for your testing:

1. Determine the data center of your broker’s demo server *.

2. Determine the data center of your broker’s live server *.

3. Determine your broker’s stop level parameters (the accepted distance between a limit order and the current price) in demo accounts**.

4. Determine your broker’s stop level parameters (the accepted distance between a limit order and the current price) in real accounts**.

5. Determine and analyze the average spread in a real account for each currency pair in a calm market and at a time when news come out***.

 

6. Rent a VPS. If your broker’s server is located in London, the VPS should also be in London. The VPS should be intended specifically for high-frequency trading. I have tested a number of them and have come to believe that the VPS here http://www.ultrafxvps.com is the optimal one.

If the broker’s server is in New York, you’ll need a VPS that is located in New York as well. Testing your program on a VPS that is unsuitable will help you realize quickly that the program doesn’t work and will not reward you financially.

 7. Install and launch the program. It is important to run the program as an administrator. Right-click with your mouse and select “run as administrator”.

 

8. Deactivate your hidden stop-loss and take-profit parameters while testing. That’s highly advisable.

 

 no hidden stop loss for arbitrage software testing

 

 How do you calculate the stop-loss level?

If you have determined that your broker’s average spread for a given currency in a period of high volatility is X, you’d want to set your stop loss at a higher level – say, 1.5-2 times the average spread. For example, if the average spread on the EURUSD pair is 0.8, the stop loss should be 1.2 (0.8 x 1.5).  You should also take into account your broker’s stop level. The program sets the stop loss based on the sum of the stop level size and the stop-loss size that you have specified. That is:

  • If the stop level is higher than the calculated value of the stop loss, set a stop loss of 0.1.
  • If the stop level is lower than the calculated value of the stop loss, set a stop loss that is equal to the calculated value less the stop level.
  • If the stop level is equal to the calculated value, set a stop loss that is equal to the calculated value of the stop loss.

 

9. Ensure that the difference to open exceeds your broker’s average spread on the currency pair in question when the market is calm. I use a value of 3 for the main currency pairs.

 

10. Ensure that the spread filters are greater than your broker’s average spread on the currency pair in question in a period of high volatility.

 

* Launch your MT4, open the Menu File and then the data folder. You need to find the “Config” folder and open the files with the .srv extension that correspond to the name of the broker. Open the file with any text editor and find the IP address or the domain name. Use the following resource to determine the location of your broker’s server: https://www.iplocation.net. You can also get that information from the broker, but brokers’ customer support staff often do not have the necessary training to be able to provide the necessary data.

 

** It is best to obtain that information from the broker and verify it.

 

*** Use any spread indicator. You can download ours for free here: https://s3.amazonaws.com/iticsoftware-products/test-your-broker.zip

 

It is better to test several brokers at the same time, but be sure to control the CPU usage on the VPS. The CPU usage can be 100% for no more than an instant. In general, the percentage should not exceed 95-96%.

vps cpu usage for arbitrage trading

The CPU can influence the performance of the application and, consequently, the results of your testing.

Once the testing in a demo account has been completed and the results are satisfactory, you can proceed to trading in a real account. If the test results are not satisfactory, there is a high probability that your setup is flawed and, most likely, the problem lies in the choice of your VPS.

When you trade on live account, control slippage and execution time

latency arbitrage log file

2016.12.13 00:48:40.613: Order #22918406 BUY 0.01 AUDUSD.. at price 0.751 SL: 0.00000 TP:0.00000 was opened
2016.12.13 00:48:40.393: Difference 3.3 pips detected on AUDUSD..(3.0). Market info :    Bid Fast/Slow:<=0.75091/0.75054=>    Ask Fast/Slow:<=0.75097/0.75059=>    Spread Fast/Slow:<=0.6/0.5 pips =>    Offset Bid/Ask:<=0.0/0.0 pips =>    Slippage = 5.0. (BUY order on AUDUSD was sent on 2016.12.13 00:48:40.393)  Last 5 ticks:0.75052/0.75054/0.75057/0.75054/0.75052/

In log file you can check price when arbitrage siruation appear, price on fast and slow broker, spread on fast and slow broker and calculate execution time and slippage.

In our example arbitrage situation for BUY appeared at 13 00:48:40.393 and price for buy (ask for slow) was 0.75059

Software opened buy at 13 00:48:40.613 buy price 0.75100

Execution time = 13 00:48:40.613 - 13 00:48:40.393 = 220 ms

Slippage = 0.75100-0.75059 = 41

If you check execution time and slipage for your first 3-4 orders and then compare each new execution time and slipage with first parameters, you will be able to stop trading when your broker change trading conditions for you.

Good luck!

Useful links:

Latency Arbitrage Software

Locking Arbitrage Software