From: Franco on 22 Jun 2010 16:07 "Ashish Uthama" <first.last(a)mathworks.com> wrote in message <op.vepasxe5a5ziv5(a)uthamaa.dhcp.mathworks.com>... > Integration needs to go both ways. > What kind of interaction does Metatrader allow with other softwares? Does > it let you call a C/C++ DLL functions? Or perhaps it provides a COM > interface which can be called by MATLAB? > > If you want Metatrader to be the 'main' software, calling into MATLAB. You > can look at these options: > > #1. Compile MATLAB logic into a DLL using the MATLAB compiler. Program > Metatrader to invoke the functions in this DLL. > This also has the added advantage that you depoly the solution on machines > which dont have MATLAB. > > #2. Use the MATLAB engine. > http://www.mathworks.com/access//helpdesk/help/techdoc/matlab_external/f29148.html > (again assume a C/C++/Fortran calling environment). If Metatrader lets you > write plugins in C/C++/Fortran(!), then this might be an option. > > #3. If Metatrader allows for a COM plugin, use MATLAB's com interface. > > On the other hand, you could think of MATLAB being the 'main' program. > You'll have to write logic in MATLAB to call into Metatrader for its part > in the solution. This might work if Metatrader has say a COM api for > MATLAB to use. > > You should be able to find most of the info for the above here: > http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_external/bp_kqh7.html > > > > You mentioned CSV files. I am guessing that this means you can do have > Metatrader read/write data into CSV files. You could leverage this for a > producer-consumer relation with MATLAB. Have both of them poll a directory > for input/output files. Say Metatrader will always put files to be > processed into this directory as in.csv and wait till a out.csv is created > in it. MATLAB could poll for in.csv, read it in, process the data, delete > in.csv and create out.csv. Hey there, thanks for the reply! As far as I know Metatrader allows function calls from dll files by importing dll files. I am not sure which dll files metatrader can call, but I have read that it works with C++ compiled files. Here is an article that explains how interaction between matlab and metatrade can be achieved using the Virtual Matlab Machine: http://articles.mql4.com/833 To be honest, I don't have a clue what is going on in that article, and how to practically use it. They do talk about "wrapping" DLL files but don't really understand what that means. I have never worked with DLL files before so I am a bit ill informed when it comes to this topic. Basically what I want to do is send a bunch of data to Matlab from metatrader (like in an array), let Matlab do the calculations, and send the results back to metatrader. A sort of function call will do the trick, for instance if I call the function FindHighValue(array), matlab will find the highest value, and return it to metatrader. I will read through the articles you gave me. Thanks for your help!
From: Ashish Uthama on 22 Jun 2010 16:54 I had a quick look, they are using the MATLAB engine interface (http://www.mathworks.com/access//helpdesk/help/techdoc/matlab_external/f29148.html) The engine interface can be used by C/C++ code, so they compile the C/C++ code into a DLL (Dynamic linked library) which is what the metatrader platform then calls. Think of the DLL as the C/C++ glue between MATLAB and Metatrader. It looks like the article has some examples and steps. You might want to give that a spin while using the above link as a reference. If you run into issues, post in this group (mention 'MATLAB engine', I dont think 'Virtual MATLAB' is commonly used here to identify this interface).
|
Pages: 1 Prev: Fitting Implicit Nonlinear Functions Next: Optimization of a discontinuous function |