Is it possible to implement a RELIABLE accounting of the aggregate position structure in MT5?
Выдох вдох хорошо дышать Чёрный горох да нелегко глотать Пуля и ствол нажал и разошлись Где добро где зло попробуй разберись А что мне надо да только свет в оконце А что мне снится что кончилась война Куда иду я туда где светит солнце Вот только братцы добраться до темна Шаг другой до счастья долеко Эй брат постой я знаю не легко Вымой лицо побрейся улыбнись Выйди на крыльцо свободе поклонись А что мне надо да только свет в оконце А что мне снится что кончилась война Куда иду я туда где светит солнце Вот только братцы добраться до темна А что нам надо да только свет в оконце А что нам снится что кончилась война Куда идём мы туда где светит солнце Вот только братцы добраться до темна Галанин С.
The topic has been raised many times:
Here is one and a second statement on the subject back in the spring. The only thing there is a mistaken overestimation by the developers that they have implemented in MT5 the storage of virtual positions on the trade server.
Lock is not the problem. The reasons for the unreliability of the MT5 concept itself are described here. And the logical private consequence:
with the current published MT5 functionality writing a RELIABLE MQL5 Expert Advisor for simultaneous manual trading on the same trading instrument is impossible!
P.S Here and here I asked beta testers how they see the solution to this problem in MT5... I didn't get an answer to such questions to the developers either.
Frankly speaking, I don't see such a big problem, especially with EA.
As long as OrderComment() exists and is executed any strategies (except for those executed manually) can be implemented as before, by writingMagic in the comment and extracting it from there. You just have to write, or rather override OrderMagicNumber() function , which seems to be absent.
And for manual trading it is desirable that this comment can be observed on the screen (as opposed to MT4 on the account history tab), and then there is nothing to think about, except for the reliability of storing information in the comment.
One method of implementation has been suggested here, but it is not reliable:
You are drawing the wrong conclusions. Both medgies and comments work the same way as in MT4.
Please wait for the release to check for yourself.
Majics and comments are stored in the order execution history, but not in the aggregate position.
Are you suggesting to analyse the history to solve the above problem?
Let me repeat, now in MT4 it is elementary for any strategy to pick up information on the current state of affairs and continue its work, as if it had never been interrupted. This information is available from open positions. In MT5 it cannot be done, because there is only scarce information on the total position, and that's it. You can analyze the history of FILLED orders, but again, this is not reliable, since not all of the history may be available for analysis (can MQL5 pump up the history of FILLED orders using the Magic filter?), it may be huge and take considerable time for its analysis.
So you suggest restoring the strategy's contribution into the total position on the basis of the FILLED orders history in MT5?
This problem was also raised with MT4 - a reliable way of marking rodders, but as we can see there has been no progress in solving it, on the contrary it has gone even further.
There is no problem with accounting for the structure of an aggregate position in MT4. You can easily and reliably write and run on MT4 independent Expert Advisors on one trading instrument and still trade there manually. And in MT5 you cannot even reliably (without breaking the logic of the strategy) trade manually together with an EA on the same trading instrument.
There is no problem accounting for the structure of an aggregate position in MT4. You can easily and reliably write and run on MT4 independent advisors on one trading instrument, and still trade there manually. And in MT5 you cannot even reliably (without breaking the logic of the strategy) trade manually together with the Expert Advisor on the same trade instrument.
The essence of the problem is clear and transparent, because I used to work in several programs of that kind. For example, the notorious Rumus or IDsystem at FK. I don't know how it will be implemented in MT5, because I haven't used it yet and still can't wait. At least this approach at least identifies some actions of Expert Advisors, it is better than nothing.
As MT5 appears we will try and look for more reliable options.
Another way of implementing through a high level API in MQL5, but again unreliable:
This is an incorrect statement. You need to try MQL5 first, then talk about the order of complication.
It will be hard to change the programming process logic gained over the years. But programs in MQL5 can be more complex than in MQL4, and it will take less time. There are so many new features that now it is difficult to imagine the entire scope of innovations. The number of useful innovations.
-------
Too bad that you will have to rewrite EVERYTHING from MQL4 to MQL5.
Of course, you can! But in most cases it is not so in MQL4->MQL5 porting.
nen, please share your vision of strategy implementation in MQL5, which allows launching several independent strategies in one trading tool.
Take any simple strategy from the standard MT4 delivery and make it a universal (independent) strategy.
With MQL4 it takes 10 lines of code and less than 5 minutes.
At MQL5 it is ... cannot even imagine.
I see the solution to this problem in creation of a higher level API in MQL5 than in MQL5 itself. This API will implement trading functions that allow working with virtual positions, which will have all those properties that MT4 has. I'm sure (a simple prophecy) that various versions of such API will appear in CodeBase MQL5, they will eliminate bugs over time and everything will be brought to perfection. Traders will simply plug in this API and then the solution of the above problem and similar ones will also take less than 5 minutes.
But, unfortunately, this solution will still not be reliable, because the database of logical links of virtual positions will not be stored on the trading server.
P.S. Also through this API powerful means of MQL5 there will be an interface for working with these virtual hand positions - an analogue of MT4.
One method of implementation has been suggested here, but it is not reliable:
You are drawing the wrong conclusions. And medgies and comments work the same way as in MT4.
Please wait for the release to check for yourself.
Magics and comments are stored in order execution history, but not in the aggregate position.
OrderMagicNumber() at least in the MT5 help, I haven't found, so where and how the magic is stored in MT5, is not clear.
OrderMagicNumber() at least in the MT5 help, I did not find, so where and how the magic is stored in MT5, is not clear.
struct MqlTradeRequest { ENUM_TRADE_REQUEST_ACTIONS action; // Тип выполняемого действия ulong expert; // Штамп эксперта (идентификатор) ulong order; // Тикет ордера string symbol; // Имя торгового инструмента double volume; // Запрашиваемый объем сделки в лотах double price; // Цена double stoplimit; // Уровень StopLimit ордера double sl; // Уровень Stop Loss ордера double tp; // Уровень Take Profit ордера ulong deviation; // Максимально приемлемое отклонение от запрашиваемой цены ENUM_ORDER_TYPE type; // Тип ордера ENUM_ORDER_TYPE_FILLING type_filling; // Тип ордера по исполнению ENUM_ORDER_TYPE_TIME type_time; // Тип ордера по времени действия datetime expiration; // Срок истечения ордера (для ордеров типа ORDER_TIME_SPECIFIED) string comment; // Комментарий к ордеру char reserved[128]; // Зарезервировано };
Another way of implementing through a high level API in MQL5, but again unreliable:
This is an incorrect statement. You need to try MQL5 first, then talk about the order of complication.
It will be hard to change the programming process logic gained over the years. But programs in MQL5 can be more complex than in MQL4, and it will take less time. There are so many new features that now it is difficult to imagine the entire scope of innovations. The number of useful innovations.
-------
Too bad that you will have to rewrite EVERYTHING from MQL4 to MQL5.
Of course, you can! But in most cases it is not so in MQL4->MQL5 porting.
nen, please share your vision of strategy implementation in MQL5, which allows launching several independent strategies in one trading tool.
Take any simple strategy from the standard MT4 delivery and make it a universal (independent) strategy.
With MQL4 it takes 10 lines of code and less than 5 minutes.
At MQL5 it is ... cannot even imagine.
I see the solution to this problem in creation of a higher level API in MQL5 than in MQL5 itself. This API will implement trading functions that allow working with virtual positions, which will have all the features of MT4 positions. I'm sure (a simple prophecy) that various versions of such API will appear in CodeBase MQL5, they will eliminate bugs over time and everything will be brought to perfection. Traders will simply plug in this API and then the solution of the above problem and similar ones will also take less than 5 minutes.
But, unfortunately, this solution will still not be reliable, because the database of logical links of virtual positions will not be stored on the trading server.
P.S. Also through this API the powerful means of MQL5 will create an interface for working with these virtual positions by hand - an analogue of MT4.
It is too complicated, and there is no need in such unnecessary work. Most likely, we can do with a simple set of classes developed for such accounting, working on the platform itself without too much excesses. But there's a complete IMHO here.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
This topic has been raised many times:
Gentlemen! Take a moment away from your voluptuous polemics and dig into the proposal:
Within MT4 write perhaps a file to be included into EAs, which would "intercept" trading signals of EAs and form signals for net positions. Of course, in the Expert Advisor trading fi ions should be replaced by those whose signals would be intercepted.
This will solve ALL your disputes, which seemingly will never end. You just need to run two versions of the same EA - one with lots, the other with a net position formed of lots.
Please think in that direction. It is constructive. (Otherwise, we will all get into a fight here, for Christ's sake!))
Here is one and second statements on this topic back in spring. The only thing there is a mistaken overestimation of developers that they implemented in MT5 storage of virtual positions on trade server.
Lock is not the problem. The reasons for the unreliability of the MT5 concept itself are described here. And the logical private consequence:
with the current published MT5 functionality writing a RELIABLE MQL5 Expert Advisor for simultaneous manual trading on the same trading instrument is impossible!
P.S Here and here I asked beta testers how they see the solution to this problem in MT5... I didn't get an answer to similar questions asked to developers either.