Function returning wrong values

 

Hi, I'm trying to create a function which returns the number of indicators in use at a given time. For now the code is showing no errors or warnings but the function always returns 0. Since both the final 2 parameters are set as true, the function should be returning 2. How can i resolve this issue? 

I know i haven't provided code from the parameters (only because its so long) but i assure you they all work perfectly! Thanks!

int numberOfIndicators(bool pBuyingCandleStickFormationComplete, bool pSellingCandleStickFormationComplete, bool pRSIEntryRequirement, bool pBB2EntryRequirement){

   int Numberofindicators = 0;

   if(pBuyingCandleStickFormationComplete == true){
      if(pRSIEntryRequirement == true){
         return Numberofindicators++;
      }
      if(pRSIEntryRequirement == false){
         return Numberofindicators;
      }
      if(pBB2EntryRequirement == true){
         return Numberofindicators++;
      }
      if(pBB2EntryRequirement == false){
         return Numberofindicators;
      }
   }
   return Numberofindicators;
}
 
luccc:

Hi, I'm trying to create a function which returns the number of indicators in use at a given time. For now the code is showing no errors or warnings but the function always returns 0. Since both the final 2 parameters are set as true, the function should be returning 2. How can i resolve this issue? 

I know i haven't provided code from the parameters (only because its so long) but i assure you they all work perfectly! Thanks!

Your code does not make much sense and needs to be simplified.

Is this perhaps what you are looking for?

int numberOfIndicators(
      bool pBuyingCandleStickFormationComplete,
      bool pSellingCandleStickFormationComplete,
      bool pRSIEntryRequirement,
      bool pBB2EntryRequirement ) {

   int Numberofindicators = 0;

   if( pBuyingCandleStickFormationComplete ) {
      if( pRSIEntryRequirement ) Numberofindicators++;
      if( pBB2EntryRequirement ) Numberofindicators++;
   };

   return Numberofindicators;
};
 
Fernando Carreiro #:

Your code does not make much sense and needs to be simplified.

Is this perhaps what you are looking for?

Just realised my mistake, thats perfect thank you

Reason: