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

 
By the way, now what Min offers is more like what you can buy than before. <br / translate="no"> Purely imho :)

Thanks! Looking forward to commercial offers. Good luck!
 
It's hard to call it an API. Library + EA. Works VERY slowly.
 
...
 
Question to the library developer: why is the speed of getting quotes when using your library even slower than when working through temporary files? What then is the advantage of using shared memory? <br/ translate="no">

What do you mean by speed of getting quotes? If it is getting ticks then I already wrote that working with ticks of quotes even directly in MT4 is difficult.
The library was not originally designed to catch ticks. It has to do with the fact that the system may simply hang up when the market is very active, because it cannot keep up with ticks. That's why the library has a built-in software protection against tick avalanche.
The advantages of using the shared memory are the high reliability of such a system and absence of hard disk clogging. Besides, several programs may access the library, and they don't need to "know" the exact location of the temporary files. Good luck!
 
When the market is very active, the system may simply freeze because of inability to keep up with ticks. That's why in the library there is a built-in software protection against tick avalanche.


it seems that the author overdid it :)
as far as I understand, if the EA is inside the start() function (and it sends information about a tick to the API client from there), then MT won't give a new tick until the EA leaves the start() function. That's why it's not clear how an avalanche of ticks may occur?

if the EA is looped and receives ticks via RefreshRates, then first it should exit from the client API, and then the call of RefreshRates will occur. That's why there's no place to freeze here either.

The advantage of using shared memory is the high reliability of such a system

sounds nice, but it's not the only way of inter-process communication.
so the topic "What's the point of shared memory usage?" isn't solved :)

imho, MMF is good only in one case when you need to pump large amounts of data between processes - pumping speed is ~150Mb/sec. (couple of months ago I had to make such mechanism just with MMF, because according to tests this is the fastest way).

in this task (transfer parameters for OrderSend etc.) - it's like a bird through a feather, easier to create a window and use SendMessage with wm_copydata.
 
sounds solid, but it's not the only way of interprocess communication. <br / translate="no"> so the topic "...What's the upside of using shared memory then?" is not solved :)

I don't think I'm arguing that the algorithm used is the best. That's the beauty of programming, that such a problem can be solved in at least a dozen ways. Variant with temporary files was also fully working. My task was to develop a reliable, workable and fully functional substitute for the MT3 API. Now the library works with the practical trading program for about half a year. And the main problem here was not the achievement of maximum speed, but reliability and proper response to a large number of emergency situations. So, thanks for your comments, they are quite appropriate, but that's "another story". Good luck!
 
Hello, so the main problem at the moment is the connection:

Include Mforex2.lib import library into the project (for Delpi - just describe the library functions),
Specify the Mforex.h header file in the main program (for example: #include "Mforex.h" - only for Builder C++);

These 2 points are mysterious to me because Omega is ready program, all other files I have placed as described, prescribed function to start MT4, and at start I got message that it is necessary to prescribe exact path, but I also prescribed path. I don't know what to do next.
 
Include in the project import library Mforex2.lib (for Delpi - only describe functions of library),<br/ translate="no"> Specify in the main program header file Mforex.h (for example: #include "Mforex.h" - only for Builder C++);
These 2 points are puzzling to me because Omega is ready-made program, all other files I have placed as described, prescribed function of MT4 start and at start I got message that it is necessary to prescribe exact path, but I have prescribed path too. I don't know what to do next.

Omega has possibility of importing functions from external DLLs. Therefore, you should specify Mforex2.dll as the external library. At the same time, this file should be in the "field of view" of the Omega programs. In the call procedures, specify the name of the functions imported from the DLL, as indicated in the documentation. Note also that Omega "doesn't know" the definitions from the Mforex.h file. That is, for example, when calling the function of opening a position, you need to specify the operation code for, say, Sell - 1, rather than OP_SELL, etc. For more details, see the DevKit documentation, which describes the way omega works with external libraries.
Good luck!
 
<br / translate="no"> It is possible to import functions from external DLLs in Omega. Therefore Mforex2.dll should be specified as an external library. At the same time, this file must be "in sight" of the Omega programs. In the call procedures, specify the name of the functions imported from the DLL, as indicated in the documentation. Note also that Omega "doesn't know" the definitions from the Mforex.h file. That is, for example, when calling the function of opening a position, you need to specify the operation code for, say, Sell - 1, rather than OP_SELL, etc. For more details, see the DevKit documentation, which describes the way omega works with external libraries.
Good luck!


So I prescribed the following in Omega:

DefineDLLfunc: "Mforex2.dll", int, "Start"; {DLL call}
_gbp = Start(); {terminal start function}

But you say that here we should write something else instead of "Start()", did I get it right?
 
<br/ translate="no"> So I prescribed the following in Omega:

DefineDLLfunc: "Mforex2.dll", int, "Start"; {call DLL}
_gbp = Start(); {terminal start function}

But you say that instead of "Start()" you should write something else, am I right?

I myself answer: You don't have to write something else instead of "Start()" - that's right, Omega starts MT4 without any problems.

But it is a little bit more complicated in the function of position opening, so I have prescribed the function:

Input: Symbol(NumericSimple), Order(NumericSimple), Lot(NumericSimple),
price(NumericSimple), sl(NumericSimple), tp(NumericSimple);


DefineDLLfunc: "Mforex2.dll", int, "NewPos",char, int, int, double, double, double;

_NewPos = NewPos(Symbol, Order, Lot, price, sl, tp);

Logically everything fits the manufacturer's description, but in practice we have problems: everything is set in numbers...
Reason: