RSI returning 1.0000

 

Hello

I have an EA but it keeps entering the trades where the RSI is above the maximum buy level, it seems to output a constant figure of 1.000. Here is the code:

indicator properties:

extern   bool       RsiVerified                     = true;
extern    int       RsiPeriod                       = 25;
extern    int       RsiBuyLevel                     = 65;
extern    int       RsiSellLevel                    = 35;

Idicator:

bool Rsi(bool up_dn,int shift=0){
   if(!up_dn){
      if(iRSI(Symbol(),Period(),RsiPeriod,0,shift)<RsiBuyLevel){return(true);}
   }else{
      if(iRSI(Symbol(),Period(),RsiPeriod,0,shift)>RsiSellLevel){return(true);}
   }
   return(false);
}

Condition statement:

if(Rsi(0)>=(RsiBuyLevel)){comm=comm+"\nCurrent Rsi "+d_str(Rsi(0))+"";return(0);}

As you can see I have the current RSI display as a comment and it shows 1.000 constantly.

Please note I am new to coding.

Thank you

Antony

 

Hi

Its ok I fixed it :)

double Rsi(int shift=0){
  
   return(iRSI(Symbol(),Period(),RsiPeriod,0,shift));

}
Reason: