Move the MQL4 function to a DLL

 

Hi,

How would I move the following function to a DLL please?

if(iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,0)>iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_SIGNAL,0)) trade=sell;

Thanks

-Maria

 
Its too late. Everybody has seen it now.
 

good one ... lol !

I am learning mql4 ... I am trying to see how pass mt4 functions to a dll ...

 

pass mt4 functions to a dll ... ???

you can pass data in array or a values to or from DLL, it is same effect as pass function since what you need are data in fact.

 
You can pass a pointer to the rates array to the dll so you have access to all prices in the chart and then re-implement MACD (and other indicators you need) in your DLL. You cannot directly call mql4 functions from your dll, unfortunately this is absolutely impossible. This is a fundamental shortcoming of the mql language, I am not aware of any existing hack that would solve this problem.
 
gctex:

Hi,

How would I move the following function to a DLL please?

if(iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,0)>iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_SIGNAL,0)) trade=sell;

Thanks

-Maria

You may want to import .mqh
 
onewithzachy:
You may want to import .mqh

This answer is not related to the question that has been asked.

 

Thanks guys. I've tested the ExpertSample that comes with the default mt4 installation and using generic math functions work just fine.

I haven't played with "import.mqh" just used the "include.mqh" so far.

Can someone please post a sample code?

-Maria

 

.mqh files cannot be imported, only included. These things are not related.


Include just includes other mql4 files at compile time, this is the only purpose of #include. Whether you have the #import in the main file or in some include file does not make any difference for the imported functions. Putting the #imports into an include files is only a convenient way to better organize your code and avoid code duplication.