how to query an external database

 

I'm a newbie with MT4/5 but I'm very good at Excel, which I've used to create a strategy.   I want to convert my logic and formulas into a working EA.

Part of the EA's job is to fetch (or read) data from an external database.   This database contains sentiment data which we mine from the web.   The data is expressed numerically, on a scale of 0 to 100. 

I need to perform some mathematical operations on this data in order to create a signal.  Part of the math is some simple averaging over a period of time, so I'm assuming that somehow the EA needs to retrieve x number of days (or bars) from the db.

I've read some of the documentation and it appears that the EA can "read" an external file.  Would this be the only (or best) approach to obtain the data in the db?  Or is there a query function I could use?


Thanks!

 
RTaylor:

I'm a newbie with MT4/5 but I'm very good at Excel, which I've used to create a strategy.   I want to convert my logic and formulas into a working EA.

Part of the EA's job is to fetch (or read) data from an external database.   This database contains sentiment data which we mine from the web.   The data is expressed numerically, on a scale of 0 to 100. 

I need to perform some mathematical operations on this data in order to create a signal.  Part of the math is some simple averaging over a period of time, so I'm assuming that somehow the EA needs to retrieve x number of days (or bars) from the db.

I've read some of the documentation and it appears that the EA can "read" an external file.  Would this be the only (or best) approach to obtain the data in the db?  Or is there a query function I could use?

Thanks!

Yes, MQL can do all of that, including reading/writing to external files and when it cannot, it can easily be extended by using DLL libraries coded with other languages linked C, C++, C# which can be used to access SQL databases for example.

I suggest you do some reading of a good programing book together with reference documentation. You will find references to MQL programming books in the following thread: https://www.mql5.com/en/forum/212643

Something Interesting to Read
Something Interesting to Read
  • 2017.08.03
  • www.mql5.com
This is the thread about books related for stocks, forex, financial market and economics...
 
Fernando Carreiro:

Yes, MQL can do all of that, including reading/writing to external files and when it cannot, it can easily be extended by using DLL libraries coded with other languages linked C, C++, C# which can be used to access SQL databases for example.

I suggest you do some reading of a good programing book together with reference documentation. You will find references to MQL programming books in the following thread: https://www.mql5.com/en/forum/212643

Thanks Fernando, I'll check into these books.   And yes its a mysql db.

Reason: