Are you trying to read a file output by MatLab, or making a call from MT4 to return data via DLL ?
Are you trying to read a file output by MatLab, or making a call from MT4 to return data via DLL ?
I am making a call from MT4 to return data via DLL.
If you wish to receive more than one value per call, then use an array to transfer the data.
If you wish to receive more than one value per call, then use an array to transfer the data.
My matlab function is like this:
Y = Myfunc(v1,v2)
The ouput Y is a cell array {y1 y2}, y1 is a 1x1 matrix, y2 is a mxn matrix, If
I call this function in MT4 via DLL, how can I get the output to MT4 environment
? thanks a lot.
Call matlab from mt4 with one of the parameters being the address of an appropriately sized/dimensioned array storage space in which matlab can store data.
If it is two arrays, you have to return them separately (two calls from MT4).
Someone else may have a better idea.
What are you building?
Call matlab from mt4 with one of the parameters being the address of an appropriately sized/dimensioned array storage space in which matlab can store data.
If it is two arrays, you have to return them separately (two calls from MT4).
Someone else may have a better idea.
What are you building?
I am building NNs in Matlab. I still don't have a clue how it works, two calls
from MT4? why does each call return one output while the function does have two
outputs? thanks
My understanding:
You can return a single value to MT4 via an external call.
Or, you can give MatLab the starting address of an MT4 array to fill with data.
I'm not quite expert on this, so I could be wrong, but, the options are limited.
Here are the MT4 side definitions from the SampleDLL
#import "ExpertSample.dll" int GetIntValue(int); double GetDoubleValue(double); string GetStringValue(string); double GetArrayItemValue(double arr[],int,int); bool SetArrayItemValue(double& arr[],int,int,double); double GetRatesItemValue(double rates[][6],int,int,int); int SortStringArray(string& arr[],int); int ProcessStringArray(string& arr[],int);
No complex types are returned, but...
bool SetArrayItemValue(double& arr[],int,int,double);
This sample call gives the address of an array to the external code which it can manipulate, as an example of you "returning" a matrix. Note it
does not "return" an array, but the array is accessible to both the DLL and MT4.
If you have to fill two arrays, you could hand over two array addresses ( ok, two calls not required )
double array1[100];
double array2[100][10];
Call to DLL/MatLab:
FillMyArrays( double &array1[], double &array2[][]);
--------
Other references
'Interaction between MetaTrader 4 and Matlab via CSV Files'
-------
You might even post your question on the Russian side of this forum, it seems to be inhabited by more experienced programmers.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
My Matlab function has a matrix output. If I call it from my EA, how do I deal with it ? If MQL4 can not handle it, how shall I get around it? Pls help me. Thanks