how do i make this loop

 

hi one part of the expert i'm working on has this loop that i have problem making it

the loop goes like this :   it opens 10 orders and when all the ten orders are opened it terminates

conditions:1- before the loop begins to work the expert opens a buy order if that buy order hits tp the first order of the loop is a buy if it hits sl the first order of the loop is a sell

2-if the first order of the loop  hits tp it opens the second order of the loop with the same order type but if it hits sl the loop goes to the top and opens the first order with the opposite order type .

for example if the first order is a buy and all the begining five orders hit tp but the 6 th order hits sl the loop goes to the top and opens the first sell order.

im a little confused about how to make this loop i would be glad if you could help me

 

Stop thinking about loops. There is no loop. You must return after the first order is opened.

When the first order is closed, then, worry about the second. etc.