Developed a library of API functions for MetaTrader 4 - page 7

 
Good afternoon, so I consulted with a programmer I know, and he explained that if this DLL was not written specifically for use in Omega, there can be no guarantee of functionality. Because Omega may not have the resources we need in the function call parameters of the DLL. Here is an example :
int TikKot(char *kotx, double *bid, double *ask, TDateTime *tim);
this line does not support data like "TDateTime *tim" in Omega.
It means that only functions of start and finish of the terminal where no parameters are set work. Where parameters are set, we need to know what parameters are taken by the DLL, it would be nice to have examples.
I think you'll have to look at an example in Delphi with a programmer who can tell you exactly what you need, and then look for Omega tools to deliver the required parameters to the DLL. If YOU wanted to release a version of the DLL specifically for Omega, it would immeasurably facilitate its rapid testing and use, I think there would be a lot of users with Omega. There are already some interested users. Here is a small extract from the Omega HELP:
An important point is the list of supported data types, see below.



DLL Function Definition

Before you can call a DLL function from EasyLanguage, you must declare the DLL using the DLL Function Declaration instruction.

Syntax:

DefineDLLFunc: "DLLNAME.DLL", Return Type, "FunctionName", Parameters;

DLLNAME.DLL is the name of the DLL where the function resides, Return Type is the type of expression that the function will return, FunctionName is the function name as defined in the DLL, Parameters is the list of parameters expected by the function (each parameter separated by comma).

It's very important to remember that 32-bit DLLs use exported, case-sensitive declared functions using _cdecl, stdcall, or fastcall. For DLLs to be compatible with EasyLanguage, exported functions must be created using uppercase letters and must be declared as _stdcall. These export functions must be listed within the EXPORTS .DEF section of the DLL file. Using "_declspec (dllexport)" from the function prototype is not sufficient for EasyLanguage to locate the exported DLL functions.

For example, the following instruction declares a function named MessageBeep that is permanently located in a DLL named USER32.DLL. It returns a boolean (true/false) value and expects a single parameter, int.

DefineDLLFunc: "USER32.DLL", bool, "MessageBeep", int;

Data Types

EasyLanguage supports many valid data types that can be used to send and receive information to functions contained in DLLs. Here is a list of data types supported by EasyLanguage:

Fundamental Data Types:

BYTE
1 byte integer data type.

char
1 byte integer data type.

int
4 byte signed integer data type.

WORD
2 byte unsigned integer data type.

long
4 byte signed integer data type.

DWORD
4 byte unsigned integer data type.

float
4 byte floating point data type.

double
8 byte floating point data type.

BOOL
4 byte boolean data type.




Variants:


UNSIGNED LONG
Same as DWORD.

VOID
Means "No returned value".

Pointer types:


LPBYTE
Pointer to a BYTE.

LPINT
Pointer to an int.

LPWORD
Pointer to a WORD.

LPLONG
Pointer to a LONG.

LPDWORD
Pointer to a DWORD.

LPFLOAT
Pointer to a float (in float FAR).

LPDOUBLE
Pointer to a double (in double FAR).

LPSTR
Pointer to a char.


All pointers are 32 bit pointers and EasyLanguage handles each of them in the same way.

It's also very important to remember that all values in EasyLanguage are floats, except for Open, High, Low and Close, which are integers. To control these prices, you must send the price scale function to the symbol that makes up the chart.

For example, if a security has a price scale of 1/1000 and the final price was 105.125, that price will be sent to the DLL as 105125. For the DLL to know how to read this price, you must send the value in the reserved word PriceScale, which in this case returns the value 1,000.
 
Omega may not have the resources you need in the parameters of the DLL function call. Here is an example :<br/ translate="no"> int TikKot(char *kotx, double *bid, double *ask, TDateTime *tim);
in this line data of "TDateTime *tim" type are not supported by Omega.

It all makes sense now. To get around this problem, try to specify the double type in Omega instead of TDateTime - i.e. int TikKot(char, double, double, double);
Actually, these types are easily interchanged and use 8 bytes of memory each. Good luck!
 
OK, thanks. What about the "char" type, Omega requires Numeric, but the DLL needs text? Is it possible to replace it ?
 
OK, thanks. What about the "char" type, Omega requires Numeric, but the DLL needs text? Can it be replaced with ? <br / translate="no">

Why? It is in the description:
LPSTR
Pointer to a char.

It's the same thing. Are there examples for these types of variables in the Omega documentation? You need to look there carefully for similar variants. Good luck!
 
Good afternoon, found the problem:
This is from the DLL help:

Note: 32-bit DLLs use case-sensitive exported functions declared using _cdecl, _stdcall , or fastcall. For DLLs to be compatible with EasyLanguage, exported functions should be created using all uppercase letters and be declared as _stdcall. These exported functions must be listed within the EXPORTS section of the DLL's .DEF file. Using "_declspec (dllexport)" from the function's prototype is not sufficient for EasyLanguage to locate a DLL's exported functions.

So it says here that Omega only works with those Functions which are written in BIG letters. I checked how it's written in another DLL, really only in BIG LETTERS.
If you change the Functions call (names in capital letters) then we can test further.
Personally I am very interested in your product and my request to you is to fit the DLL to Omega. I hope it will work... good luck!
If you don't then post here please, I will have to work on another trade automation solution. Thank you.
 
<br / translate="no"> If you change the Function call (names in capital letters) then you can test further.
Personally I am very interested in your product and my request to you is to fit the DLL to Omega. I hope it will work... good luck!

I made a variant with big function letters and sent it to your inbox. Good luck!
 
Thank you very much, I will be testing and will post the results.