Thanks, but the for(all_trades) loop itself is okay, my intention was more finding a trigger to execute it if trading of the strategy is stopped.