Wednesday, January 23, 2008

How-to AmiBroker MySQL ODBC driver.

Try to setting up a AmiBroker ODBC/SQL Data plugin, via MySQL ODBC driver.

It's here, to show what I have already did, and how I did it.
Maybe it can help someone.
Maybe someone can help me to go further.

My setting :
Windows 200 Pro
AmiBroker 5.03

Links :
http://www.amibroker.com/odbc.html

You need to install a MySQL database and something to manage it.
I think the easiest way is to use something all-in-one.

There are :
http://www.easyphp.org/
http://www.wampserver.com/
Maybe other.

I choose :
http://www.wampserver.com/
I downloaded the Windows release.
Install WampServer.
It set a tray icon.
You have to left or right click on the tray icon to access to all the commands.

Start WampServer.
Left click on the tray icon.
Choose phpMyAdmin.

Create a new database table
Start phpMyAdmin
Create a new database, TestMySQL for example.
Choose testmysql.
Click on the SQL tab.
Copy and pass the following SQL code :


CREATE TABLE `s2` (
`DATE` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`OPEN` double NOT NULL,
`HIGH` double NOT NULL,
`LOW` double NOT NULL,
`CLOSE` double NOT NULL,
`VOLUME` double default '0',
`OPENINTEREST` double default '0',
PRIMARY KEY (`DATE`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Contenu de la table `s2`
--

INSERT INTO `s2` (`DATE`, `OPEN`, `HIGH`, `LOW`, `CLOSE`, `VOLUME`, `OPENINTEREST`) VALUES
('2006-01-07 08:01:00', 100, 112, 98, 110, 1000, 0),
('2006-01-07 08:02:00', 110, 122, 108, 120, 1000, 0),
('2006-01-07 08:03:00', 120, 132, 118, 130, 1000, 0),
('2006-01-07 08:04:00', 130, 142, 128, 140, 1000, 0),
('2006-01-07 08:05:00', 140, 152, 138, 150, 1000, 0),
('2006-01-07 08:06:00', 150, 162, 148, 160, 1000, 0),
('2006-01-07 08:07:00', 160, 172, 158, 170, 1000, 0);




Now you have a new Table named s2, with somes records for test purpose.

The MySQL ODBC Driver
Now you have to dowload and install the MySQL ODBC Driver :
MySQL ODBC Driver

I choose the Windows 32 one.

Start phpMyAdmin and add a ODBC user for your database.

Start / Execute / odbcad32.exe

Click the image to enlarge it.













Database settings / Configure
Click the image to enlarge it.

Start AmiBroker.
Create a new database.




3 comments:

stempest said...

Hi,

Thanks for the how too it worked great for me.

I'm tyring to work out how to retrieve more than one value at a time from the odbc afl command
odbcGetArraySQL

have you had any experience with this?

cheers

steve

Display Name said...

Hi this is a very old post, but it helped me configure Amibroker. Thanks for that. I could manage getting rid of the error you were getting. If it helps anybody,

I imported symbol list as per http://mastersoft.diskstation.me/blog/amibroker-mysql-data-plugin-setting/. And Used custom query as given below in Quotations field.

SELECT "{SYMBOL}" AS `symbol`, `date`, `open`, `high`, `low`, `close`, `volume` FROM `_stock_{SYMBOL}` ORDER BY date DESC

Unknown said...

Hi Pierre Rougier,

Thanks for the post,this is a very old post, but it helped me configure Amibroker.

I have to upload multiple symbols in it, can any one guide me to this?

Thanks