Download MetaTrader 5
To add comments, please log in or register
Are you used to trading from your smartphone? Mobile version of MetaTrader 5 will suit you best!
Michael
6
Michael 2014.07.10 20:07 

Dear all,

 

I really hope someone can help me with that problem, I’ve been trying to find a solution for this in the internet but I’m sure I’m not getting something. Thank you for any help!

I am trying to build a DLL to which I can send rates from MetaTrader, then modify this array and return the modified array.

My DLL is setup like this:

CPP:

void MYCALC(double* MyyMatrix)

{

   *(MyMatrix+(3*6)+3) = 5; //to modify the Matrix at position[3][3]

}

 

MQL4:

#property strict

#import "MYDLL.dll"

void MYCALC(double& MyMatrix[][6);

#import

 

 

int start()

{

 

   double MyRates[][6];

   int NoOfMyRates;

   NoOfMyRates = ArrayCopyRates(MyRates,"EURUSD",PERIOD_MN1);

   MYCALC(MyRates);

   Print(„MyRates[3][3]: „,MyRates[3][3]);

   return(0);

}

  

The print call will only return the value which was copied in there by the ArrayCopyRates function and will not return the value that I have given it in my DLL. Is it even possible to do this in MQL4?

 

Thank you and best regards,

 

Michael

Alain Verleyen
Moderator
28659
Alain Verleyen 2014.07.11 13:47  

Please use the SRC button when you post code. Thank you.


whroeder1
13641
whroeder1 2014.07.11 14:13  
Michael158: Is it even possible to do this in MQL4?
  1. Don't paste code
    Play video
    Please edit your post.
    For large amounts of code, attach it.

  2. There are many examples in the code base and documentation
  3. Do you realize that Print(„MyRates[3][3] is the third bar from the right (newest,) but *(MyMatrix+(3*6)+3) is the third bar from the left (oldest)
  4. See also ArrayCopyRates - MQL4 Documentation
/
To add comments, please log in or register