English

## Where i should "return" operator in this UDF

 40 EgyAlgoTrader 2015.06.16 04:30   ```double CalculateHH ()// This function is to get the highest high price since open price of certain order                 {  for ( int n=OrdersTotal()-1; n>=0; n-- )// first i need to loop all orders           {            if (OrderSelect( n ,SELECT_BY_POS,MODE_TRADES)) // select my order of interest                {            if(OrderType()== OP_SELL && OrderSymbol()==Symbol() && OrderMagicNumber()==mBMagicf && n<=1 )                   {                    datetime    OOTs         = OrderOpenTime();          // Assumes OrderSelect() done already                    int         iOOTs        = iBarShift(NULL,0, OOTs);   // Bar of the open.                    #define     iBarCURRENTs   0                         // Include current bar.                    int         nSinceS  = iOOTs - iBarCURRENTs + 1;       // No. bars since open.                    int         iHi         = iHighest(NULL,0, MODE_HIGH, nSinceS, iBarCURRENTs);                    double      HH          = High [iHi];                // Highest high.                    return (HH);// Now i need to return this value but i am not sure where i should put the " return" operator???                   }                                   }            }         }````I am getting this error:`
 40 EgyAlgoTrader 2015.06.16 04:37 #   When i put it in this position to terminate the function and return the double value, i got this down error ```double CalculateHH ()// This function is to get the highest high price since open price of certain order                          {  for ( int n=OrdersTotal()-1; n>=0; n-- )// first i need to loop all orders           {            if (OrderSelect( n ,SELECT_BY_POS,MODE_TRADES)) // select my order of interest                {            if(OrderType()== OP_SELL && OrderSymbol()==Symbol() && OrderMagicNumber()==mBMagicf && n<=1 )                   {                    datetime    OOTs         = OrderOpenTime();          // Assumes OrderSelect() done already                    int         iOOTs        = iBarShift(NULL,0, OOTs);   // Bar of the open.                    #define     iBarCURRENTs   0                         // Include current bar.                    int         nSinceS  = iOOTs - iBarCURRENTs + 1;       // No. bars since open.                    int         iHi         = iHighest(NULL,0, MODE_HIGH, nSinceS, iBarCURRENTs);                    double (HH)          = High [iHi];                // Highest high.                                      }                                   }            }            return (HH);// Now i need to return this value but i am not sure where i should put the " return" operator???         }```
 40 EgyAlgoTrader 2015.06.16 05:34 #   However, when i added another function for getting the lowest low. I got this warning```double CalculateLL ()// This function is to get the highest high price since open price of certain order                          {  for ( int n=OrdersTotal()-1; n>=0; n-- )// first i need to loop all orders           {            if (OrderSelect( n ,SELECT_BY_POS,MODE_TRADES)) // select my order of interest                {            if(OrderType()== OP_BUY && OrderSymbol()==Symbol() && OrderMagicNumber()==mBMagicf && n<=1 )                   {                                      Comment ("Order selected");                    datetime    OOTs         = OrderOpenTime();          // Assumes OrderSelect() done already                    int         iOOTs        = iBarShift(NULL,0, OOTs);   // Bar of the open.                    #define     iBarCURRENTs   0                         // Include current bar.                    int         nSinceS  = iOOTs - iBarCURRENTs + 1;       // No. bars since open.                    int         iLi         = iLowest(NULL,0, MODE_LOW, nSinceS, iBarCURRENTs);                    double LL          = High [iLi];                // Lowest low.                                                                            }                                   }            }           return (LL);         }```