Spread Calculator

MT4 Downloads     MT4 Mobile    Demo EA's         Spread Calculator         Quote Flow Monitoring


This FREE Expert Advisor (EA) will run on a chart and store all the ticks (time, bid, ask and symbol name) in a database. You are then able to calculate different statistics on the tick data.


Use the Spread Calculator to calculate:

- Average spread

- Largest spread

- Smallest spread

- Average spread during a daily time period

- Any other statistic you want!


You can also use this EA to store ticks so that you can perform proper back testing.

This means that you can do your own calculations instead of trusting other information people are providing to you. For example, if somebody says that Broker A’s EURUSD feed is 0.5 pip spread on average. To check, you can store ALL the ticks from Broker A’s EURUSD feed and calculate the average.



Table of Contents

Step One: Install MYSQL

Performing Calculations
Step Two: Install MYSQL Query BrowserFrequently Asked Questions (FAQs)
Step Three: Install the EA 




Step One: Install MYSQL 

1) Download MYSQL from the following link: http://dev.mysql.com/downloads/mysql/5.1.html

2) Accept the terms of agreement, select the Typical setup type option and install.

3) Once installed, follow the steps in the Setup Wizard to complete configuration.

4) Be sure to select Standard Configuration.

5) On the next screen, be sure the following settings are entered.


configuration settings


6) One the next screen, be sure the Modify Security Settings box is checked and enter ‘abc123’ as the New Root Password and again to confirm. If you enter another password (for advanced users), make sure you type the correct password in point C.g.


configuration settings


7) On the next screen, leave all the boxes unchecked and click Execute and Finish.



(Back to Top)



Step Two: Install MYSQL


1) Download the MYSQL Browser from here (be sure to register on the site, this link is not an automatic download).

2) Once installation is complete, start the MYSQL Browser from the Start menu.

3) Enter the following information (leaving Stored Connection blank):


connecting to MYSQL


If you change the Schema you need to type it in in point C.g.

It will ask you Do you want to create the schema now? Select YES.



(Back to Top)



Step Three: Install Expert Advisor


1) Download the EA file from here.

Copy or download the file into the Experts Directory of your MetaTrader 4 client terminal.

Be aware that the location of this directory on your C drive changes with the white label client terminal you have.


For example:


For the default version downloaded from the MetaQuotes website:

C:/Program Files/MetaTrade4/Experts


For the version downloaded from the Boston Technologies download page:

C:/Program Files/Liquidity Connection/experts


For the FXDD white label:

C:/Program Files/FXDD - MetaTrader 4.


And so on…


2) Download the following DLL library in your library folder: www.bostontechnologies.com/downloads/EA/libmysql.dll.

3) Save the file in the libraries subdirectory of the expert directory.

4) Restart the client terminal.

5) When it opens you should see a new EA installed called: TicksInMySQL

6) Make sure that EAs are enabled.

7) Drag and drop this EA on the chart of your choice.

8) Click OK.

9) Ticks should be appearing in MYSQL Browser.



(Back to Top)



Performing Calculations


1. Open MYSQL browser

2. Login using:

-Stored connection: leave empty (do not put anything)

-Server host: localhost

-Username: root

-Password: abc123

-Default Schema: bt

-Port: 3306

3. In the MYSQL browser text window type for example:

-To calculate average spread on EURUSD on all stored ticks:

SELECT avg(ask-bid)*10000 FROM eurusd e;

-To calculate average spread on GBPUSD on all stored ticks:

SELECT avg(ask-bid)*10000 FROM gbpusd e;

It will look like this:


Spread Calculator


Then click on the green flash, the red arrow points to it, to execute each line, each request.


Examples of Useful MYSQL


SELECT * FROM eurusd;

SELECT avg(ask-bid)*10000 FROM gbpusd e;

SELECT avg(ask-bid)*10000 FROM gbpusd e WHERE

SELECT avg(ask-bid)*10000 FROM gbpusd e WHERE date > '2010-02-04 00:00' AND date < '2010-02-05 00:00';

SELECT avg(ask) FROM eurusd WHERE date > '2010-02-04 00:00' AND date < '2010-02-05 00:00';

Feel free to email us your useful MYSQL command and we will post them here.



(Back to Top)



Frequently Asked Questions

Do you offer support for this EA?

No, unfortunately we are not able to offer support for free products.


How do I do calculations on the ticks this EA stores?

You do so by actually typing MYSQL commands. You can find out more on MYSQL commands here: http://dev.mysql.com/doc/refman/5.1/en/index.html.


Is it really free?

Yes. Completely free.


Can I use it with any broker?

Yes, any broker, any symbol.


Can I use it on CFDs as well?



Why are you giving away this EA for free?

We believe that an informed trader is a trader that will make money, and when our clients do well, our company does well also.


Can you modify this EA for me?

Yes, of course. If you need the EA modified and adapted to your own specific needs, please contact us with your request and we can make the necessary modifications for a minimum charge of $250. To avoid these costs, we encourage our partners to use the free version of the EA.


(Back to Top)