How can I tell when I've reached the end of two nested for loops

 

This might seem quite trivial to some but I just can't seem to figure it out. I have a global variable 'bestMatch' that I keep updating within two for loops as seen in the relevant code below.

How can I make sure both sets of nested for loops are have completed updating before I perform any further calculations on the 'bestMatch' value?


void SearchForTheBestMatch()   {



      for (int l = 0; l <=ArraySize(allSells) - 1; l++) {
                                 
                                 if ((allSells[l] <= sellMax) && (allSells[l] >= sellMin))   {
                          for (int m = 0; m <=ArraySize(allTopFilterSells) - 1; m++) {
                                 
                                 if (allTopFilterSells[m] > bestMatch)  {
                                 
                                    bestMatch = allTopFilterSells[m];
                                 }
                              }
                          }
                          
           }
           
           
           for (int l = 0; l <=ArraySize(allBuys) - 1; l++) {
                                 
                                 if ((allBuys[l] <= buyMax) && (allBuys[l] >= buyMin))   {
                          for (int m = 0; m <=ArraySize(allTopFilterBuys) - 1; m++) {
                                 
                                 if (allTopFilterBuys[m] > bestMatch)  {
                                 
                                    bestMatch = allTopFilterBuys[m];
                                 }
                           }
                          }
                          
           }
           

}


I would want to multiple the bestMatch by a certain factor and do some other operations on it within the same method.

 
BluePipsOnly: How can I make sure both sets of nested for loops are have completed updating

When the outer loop has exited.