"Not all control paths return a value" error - page 3

 
Cristobal Giron:

I do not understand friend


JermyRec points you to a logical error made by you. It is necessary to check whether the order has been selected. The  OrderSelect() function returns true if the order was selected and false if not selected. If you do not do this check, it is possible that the order with the specified ticket does not exist. Then you can get an unpredictable result of your entire function.

int CloseOrder( int ticket, double prce){ 
//+--------------------------------------------------------------------------------------------------------------+


double price;
int     slippage;
double p = prce;
int     maxtry = RequoteAttempts;
color   CloseColor;

if (!OrderSelect (ticket, SELECT_BY_TICKET , MODE_TRADES )) return(-1); 

int ordtype = OrderType ();
if (ordtype == OP_BUY ) {price = NormalizeDouble ( Bid ,
.........
 
Keith Watford:


That's a work around, add 1 extra line

Thank you
 
Comments that do not relate to this topic, have been moved to "Off Topic Posts".
 
 - not all control paths return a value

help me????????????????????????????



string cheekmoving()


  {

   if(iMA(NULL,0,MAs,0,MODE_SMA,PRICE_CLOSE,2)<iMA(NULL,0,MAs,0,MODE_SMA,PRICE_CLOSE,1)&&

      iMA(NULL,0,MAl,0,MODE_SMA,PRICE_CLOSE,2)<iMA(NULL,0,MAl,0,MODE_SMA,PRICE_CLOSE,1))

     

      if(iMA(NULL,0,MAs,0,MODE_SMA,PRICE_CLOSE,2)<iMA(NULL,0,MAl,0,MODE_SMA,PRICE_CLOSE,2)&&

         iMA(NULL,0,MAs,0,MODE_SMA,PRICE_CLOSE,1)>iMA(NULL,0,MAl,0,MODE_SMA,PRICE_CLOSE,1))



         return ("BUY");

     



   if(iMA(NULL,0,MAs,0,MODE_SMA,PRICE_CLOSE,2)>iMA(NULL,0,MAs,0,MODE_SMA,PRICE_CLOSE,1)&&

      iMA(NULL,0,MAl,0,MODE_SMA,PRICE_CLOSE,2)>iMA(NULL,0,MAl,0,MODE_SMA,PRICE_CLOSE,1))

     

      if(iMA(NULL,0,MAs,0,MODE_SMA,PRICE_CLOSE,2)>iMA(NULL,0,MAl,0,MODE_SMA,PRICE_CLOSE,2)&&


         iMA(NULL,0,MAs,0,MODE_SMA,PRICE_CLOSE,1)<iMA(NULL,0,MAl,0,MODE_SMA,PRICE_CLOSE,1))


         return ("SELL");

     


else return ("NO");

   }

 
//else//
 return ("NO");
Just remove the 'else'.
 
8962348:
 - not all control paths return a value


Please edit your post and

use the code button (Alt+S) when pasting code

 

Hello,

Same problem here!

Can anyone help me, please?


{

   if (MathMod(FractalPeriod,2)==0)

         FractalPeriod = FractalPeriod+1;

   SetIndexBuffer(0,UpperBuffer); SetIndexStyle(0,DRAW_ARROW,STYLE_SOLID,1); SetIndexArrow(0,234);

   SetIndexBuffer(1,LowerBuffer); SetIndexStyle(1,DRAW_ARROW,STYLE_SOLID,1); SetIndexArrow(1,233);

}
 
Rodrigo Moreira:

Hello,

Same problem here!

Can anyone help me, please?


you need to post all of the code to be able to see your problem, it is not in the code you have posted so far

 
Keith Watford:


That's a work around, add 1 extra line

yea property stricts f sss things up...thanks