OnTrade() operates in mql4?

 

OnTrade() operates in mql4?

Accustomed to mql5, I see that does not work in mql4... It's like that? 

 
No, OnTrade() doesn't work with MT4.
 
Alain Verleyen:
No, OnTrade() doesn't work with MT4.

Merci beaucoup, Alain

Demande: Aucune peut pas passer les données d'un indicateur à l'autre? 

 
GlobalVariables of the terminal, file, custom events...
 
Does the documentation exist to help people to have a workaround in MQL4 to make it work as the OnTrade() function would?
 
JD4:
Does the documentation exist to help people to have a workaround in MQL4 to make it work as the OnTrade() function would?
The workaround is to check trades history. There is no necessity for OnTrade event with mql4 as the language is fully synchronized with the trade server.
 

how i solution it

int totalOrders = OrdersTotal();

void OnTick(){

//void OnTradeGambiarra(){

if(totalOrders != OrdersTotal()){

//+-----------

//Ur CODE HERE

totalOrders = OrdersTotal();

}

//}

}


 
Erick Queiroz de Faria #:

how i solution it

int totalOrders = OrdersTotal();

void OnTick(){

//void OnTradeGambiarra(){

if(totalOrders != OrdersTotal()){

//+-----------

//Ur CODE HERE

totalOrders = OrdersTotal();

}

//}

}


Very smart solution Erick .. very smart! Thanks a lot :-)

 
Nino Guevara Ruwano #: Very smart solution Erick .. very smart! Thanks a lot :-)

Not really. Triggers if an order opens or closes on any chart. Does not trigger if a pending order opens.

 
William Roeder #:

Not really. Triggers if an order opens or closes on any chart. Does not trigger if a pending order opens.


Thank you for the correction, I got it. Because the number of orders did not change when it was still pending vs when it was open position.

If we have to calculate the total number of pending orders using looping will slow down the system.

Means to deal with sub -programs related to pending orders will be more efficient using OnTimer.

Reason: