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

Vitalii Ananev
12920
Vitalii Ananev  
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 ,
.........
f4lk0
28
f4lk0  
Keith Watford:


That's a work around, add 1 extra line

Thank you
William Roeder
25088
William Roeder  
gilash1234: If u have
  1. Please don't write ur - it's "you are" or "your" - MQL4 programming forum 2014.03.04

  2. Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
              General rules and best pratices of the Forum. - General - MQL5 programming forum
              Messages Editor

Keith Watford
Moderator
31216
Keith Watford  
Comments that do not relate to this topic, have been moved to "Off Topic Posts".
navid esmaili
7
navid esmaili  
 - 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");

   }

lippmaje
1656
lippmaje  
//else//
 return ("NO");
Just remove the 'else'.
Keith Watford
Moderator
31216
Keith Watford  
8962348:
 - not all control paths return a value


Please edit your post and

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

Rodrigo Moreira
30
Rodrigo Moreira  

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);

}
Paul Anscombe
6233
Paul Anscombe  
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

jack zorlob
19
jack zorlob  
Keith Watford:


That's a work around, add 1 extra line

yea property stricts f sss things up...thanks