There are two ways of tracking changes in the order list (which includes both pending orders and open trades):
By using the main OnMessage handler to listen for the ORDER_OPEN, ORDER_CHANGE, and ORDER_CLOSE messages
By defining any or all of OnOrderOpen, OnOrderChange, and OnOrderClose handlers