differences of PC resource usage between 2 code structures

 

Hi I've created 2 EA now and I build it with the idea of using the first EA as a template for the second one. There's a section on the EA which is to manage an open orders, in this case I use this 3 function to manage close, update open price, SL and TP and also take a partial TP.

CloseOrders()
UpdateAllOpenOrders()
PartialTP() //if the strategy using partial TP
//will do for loop 3 times as function above get called

In these function, for every function because I create it separately it will start with for loop statement. In terms of PC resources usage is there a big different If I take the for loop of every function and put it above the rest of the function like code below?

for(int i=OrdersTotal()-1; i>=; i--)
{
   CloseOrders()
   UpdateAllOpenOrders()
   PartialTP()
}
//only doing single loop for all the function above
 
for(int i=OrdersTotal()-1; i>=; i--)
{
   CloseOrders()
   UpdateAllOpenOrders()
   PartialTP()
}
//only doing single loop for all the function above

That just calls your functions n times.

You need to select an order, filter by MN and symbol. Then each function can operate on one order.

 
William Roeder #:

That just calls your functions n times.

You need to select an order, filter by MN and symbol. Then each function can operate on one order.

I select the order, symbol and magic number in the function, it is somewhat wrong but it just example to describe using for loop once vs every single function has any different PC resources usage (make it slower to open order an etc.) or not