VB6 to C#‎ > ‎VB6 to C# Downloads‎ > ‎

Code to Export C# DLL to Metatrader 4

See the two new Metatrader buid 600+ files just uploaded (below). These files relate to this article: Code to Export C# DLL to Metatrader Build 600+.

Instructions for installing Visual Studio C# DLL and Metatrader 4 script to test C# to Metatrader DLL capability. Please note: this is sample code only! 

1) Download the two files below.

2) Place ..\Test\testUnmanagedDLL\testUnmanagedDLL\bin\Debug\x86\testUMD.dll in your metatrader\experts\libraries folder.

3) Place testDLL.mq4 in your metatrader\experts\scripts folder and (re)start Metatrader 4 (MT4) if the script fails to show up in the Navigator window.

4) From within MT4 double click (or drop on a chart to run) the testDLL script in Metatrader 4 to test the dll. You should see something appear in your Experts tab within Metatrader 4.If you used the 64 bit or Any CPU DLL build option from within C# you will see error #127. Error #127 in MT4 basically means that your DLL was found but your entry point / function / method name was not found.

I had to play around with the Unmanaged Exports template a bit before getting it to work/compile. In fact, I tried to reproduce the project but was unable, so I made a backup of the project, gutted the code and am able to use this as a template for other Unmanaged Exports projects...until I figure out what exact steps I went through to come up with this demo. ;) If you have problems reproducing the project then use testUnmanagedDLL.zip as a template each time you need to create a new C# DLL.

5) Do something amazing with C# and MT4 and have fun!!!

More discussion and a code listing can be found at Code to Export CSharp DLL to Metatrader.
Patrick White,
Jun 27, 2012, 12:40 AM
Patrick White,
May 11, 2014, 10:20 PM
Patrick White,
Jun 27, 2012, 12:50 AM
Patrick White,
May 11, 2014, 10:19 PM