Very hard programming problem I need help with .....

 
Hello,

Let's assume we have 4 different order open. Let's name these orders, Order1, Order2, Order4 and Order5.

I want to write some code so that we firstly scan through all opentrades in trade terminal and then if Order 3 is not present in the trade terminal, then we do some action. So code needs to check each order in trade terminal and then once has done this, if Order 3 has not been opened, we do some action (eg like open order 3 if certain conditions are met). How do I write this code? I have tried using loops, while, TotalTrades and For functions but can't find the solution.

How do I code this?

Thank you for your help.

Kind regards

RJF