Modify Array with Rates in a DLL

 

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

 

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


 
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
Reason: