Discussion of article "Library for easy and quick development of MetaTrader programs (part IV): Trading events"

 

New article Library for easy and quick development of MetaTrader programs (part IV): Trading events has been published:

In the previous articles, we started creating a large cross-platform library simplifying the development of programs for MetaTrader 5 and MetaTrader 4 platforms. We already have collections of historical orders and deals, market orders and positions, as well as the class for convenient selection and sorting of orders. In this part, we will continue the development of the base object and teach the Engine Library to track trading events on the account.

Let's launch the EA in the tester and try the buttons:

All is activated correctly, and the journal receives messages about occurring events.

Currently, all event messages in the tester journal are displayed in the CEngine::WorkWithHedgeCollections() method of the library base object, and we need the custom program to know the event codes in order to "understand" what happened on the account. This will allow us to form the program's respond logic depending on an event. To test the ability to achieve that, we will create two methods in the base object of the library. One method is to store the code of the last event, while another one is to decode this code consisting of a set of event flags.

Author: Artyom Trishkin

 
ORDER_STATUS_MARKET_ORDER gives error : undeclared identifier. looks like things changed in recent versions for MQL 5, it shows up both in COrder::OrderMagicNumber and CMarketOrder Constructor!
 
theonementor # :
ORDER_STATUS_MARKET_ORDER gives error : undeclared identifier. looks like things changed in recent versions for MQL 5, it shows up both in COrder::OrderMagicNumber and CMarketOrder Constructor!

I downloaded the MQL5.zip archive file attached to the article - each file individually and all together (when compiling Engine.mqh or TestDoEasyPart04.mq5) are compiled without errors.

What exactly are you doing that you are getting a compilation error?

 
Artyom Trishkin #:

I downloaded the MQL5.zip archive file attached to the article - each file individually and all together (when compiling Engine.mqh or TestDoEasyPart04.mq5) are compiled without errors.

What exactly are you doing that you are getting a compilation error?

Figured it out, there was one entry missing from the define enum. somehow It was missing (although I copy paste the code from the tutorial into the editor)
 
theonementor # :
Figured it out, there was one entry missing from the define enum. somehow It was missing (although I copy paste the code from the tutorial into the editor)

The codes in the article do not always match the codes in the attached files. Sometimes I may miss something during the description, and sometimes something is added after writing the article. The article is not a step-by-step guide in the “read-copy-use” style, but only a detailed explanation in the form of training material. And small errors and omissions make you think, and that’s good)