Need help checking positions / order status

 
I have code that implements the following two statements from the example code supplied:

If TotalTrades < 1 then (no outstanding positions or orders)
...


for cnt=1 to TotalTrades (should drop in here if there are any open orders or positions)


However, I'm never seeing 'TotalTrades' getting a value other than 0 when trades are executed in the test environment (FXDirectDealer). I see Buy orders going through but it never drops into the 'for' statement. Is this the correct way to go about managing orders? if so, what could i be doing incorrectly?
 
I am not sure I understand your problem (its a bit late here) but if u go to this post, u will find a bit of code that goes through all open orders:

"A code to close all open orders?"

hope it helps..
Reason: