Discussion of article "Library for easy and quick development of MetaTrader programs (part X): Compatibility with MQL4 - Events of opening a position and activating pending orders" - page 2

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I also want to be able to run your library in Virtual. For this purpose I need to have access to MT4-style part of the library.
I managed to run it
I.e. the whole event model of the library works in virtual environment as well.
I have sent a variant of your library, which works in MT5 via your MT4-style-logic.
The point is that cross-platform libraries have a much higher probability of working in MQL4-style part of the library than in MQL5-style. Therefore, when using cross-platform libraries, I prefer to use their MQL4-style logic in MT5. It is much more reliable in MT5.
I think that in MT5 your MQL5-style logic will take a long time to detect bugs, while MQL4-style will have bugs, but only a minimum number and not critical ones.
In this library there is no division of logic into MQL5 and MQL4. It works with the actual state and actual changes in the state of the trading environment. Purely MQL5-OnTradeXXX functions are not used - everything is taken from the state of the trading environment. That is, it is not an event-based model. That's why I say - the logic is the same, the implementations are slightly different due to the difference in the necessary functions for working with the environment.
In your library, everything is subordinated to porting MQL5-style to MQL4-style, while here - in this library - it is rather the opposite - MQL5-style (as more flexible) is ported to MQL4. Thus, the library provides a little more for MQL4 than the standard MQL4 features - for example, it has a similar PositionID for MQL4, here you can find out during the work (not when calculating history) from which order the position was generated. Unfortunately, there are no deals for MQL4 - there is no such data. Well, or I didn't think much about it....
Based on all of the above, I repeat - there is no division into two styles - it is the same for both platforms. Therefore, I do not understand your desire to convert twice to MQL4 what has already been converted.
Based on all of the above, I repeat - there is no division into two styles - it is the same for both platforms. Therefore, I do not understand your desire to convert twice to MQL4 what has already been converted.
The misunderstanding is only in terminology. Your library for MT4 is a wrapper, which is written in MQL4. This is MT4-style. This is the part I needed. Actually, I have done it.
The misunderstanding is only in terminology. Your MT4 library is a wrapper written in MQL4. This is MT4-style. This is the part I needed. Actually, I have done it.
Hello Artem. I'm having trouble working with this library. I'm trying to use it in MQL4.
Yesterday I connected it to my EA in the tester and even received messages about opening or closing positions. But today I transferred what I had for the tester to a new EA, without buttons to open positions and I am trying to get a message about opening or closing positions, but I don't get it. And according to my plans I should get a ticket of position, price and time. I could not get this even in the tester.
And the most baffling thing is, I've now put my probe with buttons on the chart..... No messages come through. Put it back in the tester, everything works.
ps; I figured it out. It is necessary to enable OnChartEvent with custom event.
And the most baffling thing is, I've now put my button probe on the chart..... No messages come through. I put it back in the tester, everything works.
Remove all references to the timer from the EA - the library creates its own timer for it and works in it. Everything is done for simplicity and convenience.
Removed the timer, inserted OnChartEvent in this form. Button control is probably not needed, and the user event I think is created somewhere in the wilds of the library. But I didn't get the result.
I removed the timer and inserted OnChartEvent in this form. Button control is probably not needed, and the custom event I think is created somewhere in the wilds of the library. But I didn't get the result.
Artem, please tell me what role the highlighted code section plays
How can this code be executed if the timer is not enabled?
But if this code section is deleted, the event messages are not printed. But everything works with it.
And I would like to get a ticket, prices and possibly some other properties of positions and orders together with the event message.