C++ DLL for Metatrader 4: correct parameter passing syntax

I would like to learn the correct syntax for passing arguments to a C++ DLL that will be called from a Metatrader 4 .mq4 file, and to receive the output from the DLL for plotting in an indicator and use by an EA. As a guide to what I would like see the thread on the forum at [url removed, login to view], but I want C++ and not Pascal.

Specifically, I would like the correct syntax for these (incorrect?) equivalents:

for the .mqh file

#import "[url removed, login to view]

void updateBuffer( double& history[][6], double& buffer[], int bars, int indicator_counted, int ma_period );


for the .mq4 file

#import "[url removed, login to view]"

// history and buffer are passed by reference, this means the dll will receive pointers to the arrays

void updateBuffer( double& history[][6], double& buffer[], int bars, int indicator_counted, int period );


double history[][6];

ArrayCopyRates(history, NULL, 0);

int start(){

updateBuffer( history, buffer, Bars, IndicatorCounted(), ma_period);


for the C++ DLL


#define MT4_EXPFUNC __declspec(dllexport)




#pragma pack(push,1)

struct history { unsigned int ctm; double open; double low; double high; double close; double vol; };

struct MqlStr { int len; char * string; };

#pragma pack(pop)


MT4_EXPFUNC void _stdcall updateBuffer( double * history, double * buffer, int Bars, int IndicatorCounted, int ma_period )


in the main code I want the correct way to access the variables in history and to write output to buffer


The purpose of this project is for me to learn the relevant and correct coding syntax for future projects I have in mind rather than just recreating some online code. I will be using Dev-C++ for my C++ compiling and I do NOT want code that is specific only to Visual Studio C++.

Skills: C++ Programming, Metatrader

See more: mt4_expfunc, dll metatrader, metatrader dll, dll mt4, mt4 struct, mt4 string, dll mq4, metatrader string, dev dll mt4, dev mq4, mq4 mt4 dll passing string, mt4 dll data metatrader arraycopyrates, dll double mt4, mt4 dll char, dll output mt4, dll parameter passing, mt4 dll history data import, guide write dll metatrader, mq4 double, dll dev mt4, metatrader struct mqlstr, int parameter metatrader, metatrader passing reference, mt4 indicator arrays dll, metatrader double dll

About the Employer:
( 0 reviews ) Slupsk, Poland

Project ID: #1116775

2 freelancers are bidding on average £100 for this job


pls check PMB

£100 GBP in 1 day
(14 Reviews)

Kindly Check PMB please. Thank you.

£100 GBP in 2 days
(2 Reviews)