Spread Calculator
This EA puts all ticks inside a MYSQL Database where you can do any calculations you want on the ticks.
Executive Summary
Boston Technologies has made available to everybody a FREE Expert Advisor (EA) that will run on a chart, and will store all the ticks ( time, bid, ask and symbolname) in a database.
One can then calculate different statistics on the tick data.
One can use this EA to calculate for example
- The average spread of a feed
- The largest spread
- The smallest spread
- The average spread during a daily time period
- And any other statistics one wants to calculate
What does it mean for you?
This means that you can do your own calculations instead of trusting what 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. You can store ALL the ticks from Broker A’s EURUSD feed and calculate the average yourself to check.
How to install?
The installation takes 10-15 minutes if you click on next everywhere and read only the information in red.
To use this EA you need to do 4 steps
- You need to install MYSQL on your computer and start it
- You need to install MYSQL Query Browser so that you can work on the date in the MYSQL database and do queries and calculations on the data.
- You need to install the EA and launch it on one or more charts of interest to you.
-
A.)
Download MYSQL from here
(pick the closest location to you) :
http://dev.mysql.com/downloads/mirror.php?id=382190#mirrors
- You should receive a file called mysql-essential-win32.msi. The version number might increase as new versions are releases. Save and double click on this file to launch the installer.
-
Chose the following options:
- Typical and click next
- Install wait for it to install
-
Now we will configure it:
- Click on next.
- Next again.
- Leave Configure MYSQL server now ( you can disable the register the MYSQL server now, it will save you time).
- Click on Finish
- Click on Next
- Select Standard Configuration. Click on next.
- Leave Install as Windows Service checks only. Leave Launch the MYSQL server automatically checked. No need to check the include Bin option. Leave service name MYSQL (good practice).
- Leave Modify Security Settings. In New root password type : test747
- In confirm also type : test747
- If you type another password (for advanced users) make sure you type the right password below in point C.g.
- Do not check anything else.
- Click Execute
- Click Finish
- The MYSQL server is installed.
-
Now download the MYSQL Browser from here ( this is a graphical user interface that will allow you to actually work with MYSQL without needing to know very much MYSQL at all)
- Download it from here: http://dev.mysql.com/get/Downloads/MySQLGUITools/mysql-gui-tools-5.0-r17-win32.msi/from/pick#mirrors
- Pick a close location. Save the file mysql-gui-tools-5.0-r17-win32.msi (version name might change).
- Execute the file.
- Select Run.
- Select Next.
- Say Next to everything.
- Check Accept. Click on Next.
- Next
- Next (leave default option checked)
- Install
- This is REQUIRED to configure the MYSQL DB you need to start the MYSQL Browser:
- Start MYSQL QUERY BROWSER from the Start menu.
-
Login using:
- Stored connection: leave empty (do not put anything)
- Server host: localhost
- Username: root
- Password: test747
- Default Schema: bt
- Port: 3306
- It will ask you Do you want to create the schema now? And YES.
-
EA installation , this is the same installation as any other EA.
- Download it from here: www.bostontechnologies.com/downloads/EA/TicksInMySQL.ex4
-
Save this file in the Expert subdirectory of your Client Terminal.
If you use our Client Terminal from here ( www.bostontechnologies.com/downloads/lc4setup.exe ) then this is in: C:\Program Files\Liquidity Connection\experts- For Citi Bank: C:\Program Files\Citi FX MT4 powered by BT\experts
- And so on.
- Download the following DLL library in your library folder: www.bostontechnologies.com/downloads/EA/libmysql.dll
-
Put it in the libraries subdirectory of the expert directory.
- For example in : C:\Program Files\Liquidity Connection\experts\libraries
- For Citi Bank: C:\Program Files\Citi FX MT4 powered by BT\experts\libraries
- And so on.
- Then restart the client terminal.
- When it opens you should see a new EA installed called: TicksInMySQL
- Make sure that EAs are enabled.
- Drag drop this EA on the chart of your choice.
- Click ok
- Ticks should be appearing in MYSQL Browser
How do I do math on the ticks after the EA is storing them in MYSQL?
- Open MYSQL browser
-
Login using:
- Stored connection: leave empty (do not put anything)
- Server host: localhost
- Username: root
- Password: test747
- Default Schema: bt
- Port: 3306
-
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;
-
To calculate average spread on EURUSD on all stored ticks:
It will look like this:
Then click on the green flash, the red arrow points to it, to execute each line , each request.
Example 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.
