You can use the following macros:

This loops through all open, closed and pending trades:

Code:
for(all_trades)



This one loops through all open and pending trades:

Code:
for(open_trades)



This one loops through all open and pending trades of the currently selected asset/algo combination:

Code:
for(current_trades)



You get access to each individual trade's trade variables and trade statistics inside the loops.