Consider adding logging statements to log all relevant values before the order close gets called. Such that you see which execution paths get taken and why, see:
https://www.dukascopy.com/wiki/#IConsole/Logging_valuesIn case the orders get closed by SL or TP make sure that you set the prices in right directions. Also consider adding logging in
onMessage as it is done here:
https://www.dukascopy.com/wiki/#Set_Stop_Loss_price/Detect_close_by_Stop_Loss