Convert call dll from Metastock to MetaTrader4

#1
Please help me to call dll file using MT4

File name: FileName.dll
Function name is : CheckFunction

Metastock formula to call dll function is :
Buy
ExtFml( "FileName.CheckFunction") = 1

Sell
ExtFml( "FileName.CheckFunction") = 0
 

mastermind007

Well-Known Member
#2
Please help me to call dll file using MT4

File name: FileName.dll
Function name is : CheckFunction

Metastock formula to call dll function is :
Buy
ExtFml( "FileName.CheckFunction") = 1

Sell
ExtFml( "FileName.CheckFunction") = 0
General steps to call any function from any dll are

1) Load Library
2) obtain function pointer of the desired function from the export table of the loaded library
3) call the function pointer
4) Repeat steps 2 and 3 as many times as necessary
5) Unload library

But, to successfully complete each of the step requires some programming skill.

There are lot of complications involved. Some C DLL (notably microsoft) use parameter loading in opposite order (sometimes called PASCAL convention) as opposed to default C convention.

Some compilers expect strings memory allocation to be on stack whereas others expect it to be in heap memory.
 
#3
Hi Master Mind,

thank for your help


is this correct?

this is my try:

#import "FileName.dll";
double CheckFunction();
#import

and in the void OnTick() I put this
Print(CheckFunction());

but no value showed up!!!
 

Similar threads