The function OnTrade() is called three times when the Trade event occurs,why?

 

Why is function OnTrade() called three times when the Trade event occurs? It should be once. Right?

 
kwang1:

Why is function OnTrade() called three times when the Trade event occurs? It should be once. Right?

Wrong but your are not the first. OnTrade() is called for each trade event. When you send an order, there are several trade events. Unfortunately the documentation for OnTrade isn't detailed. However, the more recent OnTradeTransaction() event handler is more easy to use and more documented.

Reason: