Error of " '}' - not all control paths return a value"

 

Hello,

I meet a problem when I try to compile my EA, it return me a error message " '}' - not all control paths return a value" .

How can I solve it??

 
Antoine:

Hello,

I meet a problem when I try to compile my EA, it return me a error message " '}' - not all control paths return a value" .

How can I solve it??

 

 

look in every condititional statement, or paste the function
 

I will paste it tonight, I can't do it now.

Thank you.

 
See attach my EA:

Files:
 
Antoine:
See attach my EA:

Your problem is quite easy - your main function is int OnCalculate and, as it is declared as function returning an integer (int) value, it should return such value at the end of function body. OnCalculate should return rates_total:

...
      CANDLE_STRUCTURE cand3;
         cand3=cand2;
         cand2=cand1;
         if(!RecognizeCandle(_Symbol,_Period,time[i-2],InpPeriodSMA,cand1))
            continue;
         bool Buy_Condition_1 = (cand3.trend==DOWN && !cand3.bull);
         bool Buy_Condition_2 = (cand3.type==CAND_LONG || cand3.type==CAND_MARIBOZU || cand3.type==CAND_MARIBOZU_LONG);     
      }   
      return(rates_total); // this is what your code was lacking
  }
 

what is my problems?

 
arminbahramian:

what is my problems?

You have your return inside the if condition.

You need to return something if the if condition is not satisfied.