Discussion of article "Processing of trade events in Expert Advisor using the OnTrade() function"

 

New article Processing of trade events in Expert Advisor using the OnTrade() function is published:

MQL5 gave a mass of innovations, including work with events of various types (timer events, trade events, custom events, etc.). Ability to handle events allows you to create completely new type of programs for automatic and semi-automatic trading. In this article we will consider trade events and write some code for the OnTrade() function, that will process the Trade event.

Figure 1. Alerts

Author: KlimMalgin

 

MQL5 supplies event processing mode, 

Why do not supply event's praramers?

 

Wish like  OnChartEvent(....), supply event id and parameters!!!!!!!!!!!!!

 

 
DxdCn:
Wish like  OnChartEvent(....), supply event id and parameters!!!!!!!!!!!!!

The OnChartEvent is used in the article Creating Active Control Panels in MQL5 for Trading.

 
Automated-Trading:

The OnChartEvent is used in the article Creating Active Control Panels in MQL5 for Trading.

 

I mean : OnTrade()  

should  be OnTrade( id,  para1,para2.....) 

 

Hi ,


thanks for writhing this aritce... I played a litte around with your code. But at first I have the basic problem, that I am worling with positions. That means:

My EA is setting a buyorder in the backtest  and the Ontrade function is called several times as described. But your code is only checken OrdersTotal. The strange thing is: the result of this function is always 0. After placing my Order I only have a Buy position, which is not handled of your code, isnt it ?

Whats wrong here?

Reason: