Fastest way to export data from mt4?

 

Currently my mql4 script serializes OHLC data to delimited string and passes it to a DLL which performs further analysis. The performance is not very good, so I am thinking about alternatives. Would writing historical data from OHLC buffers to a binary file in a format just like .hst files be any quicker? At first I thought that working with files will be slower than handling strings in memory, but maybe there is something that I do not know about efficiency differences between FileWriteDouble and large string handling in MQL4.

Other alternative would be passing unserialized OHLC arrays as parameters to my DLL. Any size constraints here? My DLL is written in managed C#, with fixed vtables to make it work with MT4.

One more alternative was reading .hst files directly, but I have found that MT4 updates them on a random basis, so very often I am unable to extract latest data this way. Is there a way to force the update of .hst files?

Any useful input would be appreciated. Thanks :)

Quaestus

 

Use the rates array. The following thread on FF should give you all information you need (I's not C# but the principle is the same and should be applicable to C# (or at least it should show you how the unmanaged data structures have to look like. Unfortunately I cannot help you with all the necessary marshalling stuff in C#, this must be done by an experienced C# programmer)):

http://www.forexfactory.com/showthread.php?t=219576

Btw: Managed code like C#/.NET is not the best of all possible choices to write DLLs for MT4, you should do yourself a favor and use something like C++ or Object Pascal which makes it much easier to create a plain DLL with good old flat C function exports and easy access to all the unmanaged native pointers and data without jumping through hoops and marshalling back and forth, etc. You will also have much less problems with deploying the dll to other machines. C# does not really shine in this area.