| / | Forum |
|
marshall318
2008.01.20 03:16
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 |
|
I would say while Money Management is a very important element, a complete EA is the one that consists of a successful strategy, risk management, and money management. While without money management the odds of winning are very low, you also need to have a correct understanding of risk and strategy. The bottom line is that they all go hand in hand. |
|
phy
2008.01.20 21:53
Are you trying to read a file output by MatLab, or making a call from MT4 to return data via DLL ? |
|
marshall318
2008.01.20 23:46
phy wrote: 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. |
|
phy
2008.01.21 03:12
If you wish to receive more than one value per call, then use an array to transfer the data. |
|
marshall318
2008.01.23 11:23
phy wrote:
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. |
|
phy
2008.01.23 21:56
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? |
|
marshall318
2008.01.24 06:01
phy wrote:
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?
|
|
phy
2008.01.24 06:31
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);
bool SetArrayItemValue(double& arr[],int,int,double);
|