How to connect to Mysql from C# as MT4 dll?

1.9k views Asked by At

I am new to C#. I want to connect to Mysql Database from MT4 using DLL. I found how to create MT4 dll using C# here : http://vb6-to-csharp.blogspot.com/2012/04/code-to-export-c-dll-to-metatrader.html , and how to connect to Mysql database using C# here: http://www.codeproject.com/Tips/423233/How-to-Connect-to-MySQL-Using-Csharp .

How to combine both to connect to Mysql from MT4 ?

Thanks

2

There are 2 answers

0
Lefteris E On

MT4 is C++ not C#. In fact by using C# you are complicating things unnecessarily because you need to marshall the datatypes between the two languages. Also you didn't specify what part of mt4 you want to connect. I assume it's the client terminal via an expert advisor's dll. The simplest way is to write a dll using C++ which will export the methods you need for writing to the database.

0
battlmonstr On

If you prefer C# over MQL a viable option is to use a framework that lets you code a complete EA using C#. For example this bridge: NQuotes : C# API for MetaTrader let's you doing that. Then you can use your MySQL tutorial as it is.