Experts: TicksInMySQL

 

TicksInMySQL:

TicksInMySQL Expert Advisor.

Author: Collector

 
i would like to know how it works

and can we do it for MS Access??


that 's good work at all
 

WRITE CODE

  string query = "";

   int length = 0;
   query = StringConcatenate("insert into ticks(margin,freemargin,date,ask,bid,symbol,equity) values(",
                             AccountMargin(), ",", AccountFreeMargin(), ",\"",
                             TimeToStr(CurTime(), TIME_DATE|TIME_SECONDS), "\",",
                             NormalizeDouble(Ask, 4), ",", NormalizeDouble(Bid, 4),
                             ",\"", Symbol(), "\",", AccountEquity(), ");");
   length = StringLen(query);
   mysql_real_query(mysql, query, length);
   int myerr = mysql_errno(mysql);
   if(myerr > 0)
       Print("error=",myerr);

 

HOW DO READ CODE ?

SAMPLE Select equity from tick ?

 

This puts data into the database. Before you can use this you need a database & table to save the data in.

 I *think* this should be the MySQL table structure:

 CREATE TABLE IF NOT EXISTS yourtablename (

id int(11) NOT NULL AUTO_INCREMENT,

  margin float NOT NULL,

  freemargin float NOT NULL,

  `date` datetime NOT NULL,

  ask float NOT NULL,

  bid float NOT NULL,

  symbol varchar(25) NOT NULL,

  equity float NOT NULL

) ENGINE=InnoDB DEFAULT CHARSET=utf8;

After the data has been entered into the table by any SELECT query. For instance to select only the last 5 entries (in MySQL):

SELECT * FROM yourtablename ORDER BY id DESC LIMIT 5;

I will post the actual script/mql part as soon as I have played around with it for a bit :)

Reason: