Help required for function of the highest Rsi of the day - Solved

 

Hi

I have an EA that I need to add a function that can calcuate the highest RSi of the day, but I require some help, here si my code:

   double Rsi(int shift=0){
  
   int theRsiPeriod;
   if(Period() == PERIOD_M1)
      theRsiPeriod = RsiPeriod2;
   if(Period() >= PERIOD_H1)
      theRsiPeriod = RsiPeriod3;
   if(Period() >= PERIOD_M5 && Period() <= PERIOD_M30)  
      theRsiPeriod = RsiPeriod;
   return(iRSI(Symbol(),Period(),theRsiPeriod,0,shift));
  
   //check for highest RSI

   int i;
   double RsiHigh = iHighest(iRSI(Symbol(),Period(),theRsiPeriod,0,i+1));
}

The i+1 refers to the candle previous to the start of my pattern, I know I need to sort out the day start/end times which I think I can do but I am stuck with working out the highest RSI within the start/end times.

Thanks

Antony

 
int start(){
//~~~~~~~~~~
for(int i=0;i<Bars;i++){
    double Highest_RSI_ofDay;
    if(Time[i]>=iTime(NULL,PERIOD_D1,0)){
        if(iRSI(NULL,0,14,PRICE_CLOSE,i)>Highest_RSI_ofDay){
            Highest_RSI_ofDay=iRSI(NULL,0,14,PRICE_CLOSE,i);
    }}else{break;}
}
//~~~~~~~~~~
Alert(Highest_RSI_ofDay);
//~~~~~~~~~~
return(0);}
 

Hi

Thanks for the quick reply, the only thing is int start() has already been used in my EA so what would be the alternative in this case?

Thanks

Antony

 

Think I got it:

double Rsi(int shift=0){
  
   int theRsiPeriod;
   if(Period() == PERIOD_M1)
      theRsiPeriod = RsiPeriod2;
   if(Period() >= PERIOD_H1)
      theRsiPeriod = RsiPeriod3;
   if(Period() >= PERIOD_M5 && Period() <= PERIOD_M30)  
      theRsiPeriod = RsiPeriod;
   return(iRSI(Symbol(),Period(),theRsiPeriod,0,shift));



//~~~~~~~~~~
for(int i=0;i<Bars;i++){
    double Highest_RSI_ofDay;
    if(Time[i]>=iTime(NULL,PERIOD_D1,0)){
        if(iRSI(NULL,0,14,PRICE_CLOSE,i)>Highest_RSI_ofDay){
            Highest_RSI_ofDay=iRSI(NULL,0,14,PRICE_CLOSE,i);
    }}else{break;}

//~~~~~~~~~~
Alert(Highest_RSI_ofDay);
//~~~~~~~~~~

return(0);}

}

Thanks

Antony

 
double RenameMe_Function(){
//~~~~~~~~~~
for(int i=0;i<Bars;i++){
    double Highest_RSI_ofDay;
    if(Time[i]>=iTime(NULL,PERIOD_D1,0)){
        if(iRSI(NULL,0,14,PRICE_CLOSE,i)>Highest_RSI_ofDay){
            Highest_RSI_ofDay=iRSI(NULL,0,14,PRICE_CLOSE,i);
    }}else{break;}
}
//~~~~~~~~~~
Alert(Highest_RSI_ofDay);
//~~~~~~~~~~
return(Highest_RSI_ofDay);}
 

Thank you, you have been really helpful, I am learing a lot from this forum when learning to code, jsut one last question, could I use the same code to look for the lowest Rsi for the day?:

double Rsi_high_low;
//~~~~~~~~~~
for(int i=0;i<Bars;i++){
    double Highest_RSI_ofDay;
    if(Time[i]>=iTime(NULL,PERIOD_D1,0)){
        if(iRSI(NULL,0,14,PRICE_CLOSE,i)>Highest_RSI_ofDay){
            Highest_RSI_ofDay=iRSI(NULL,0,14,PRICE_CLOSE,i);
    }}else{break;}

//~~~~~~~~~~
Alert(Highest_RSI_ofDay);
//~~~~~~~~~~
return(Highest_RSI_ofDay);}

return(0);}

Thanks

Antony

 

Yes. Define a variable called. Lowest_RSI or whatever.

Then add another if(){} one the same level as the RSI line.

if(iRSI(NULL,0,14,PRICE_CLOSE,i)<Lowest_RSI_ofDay){
  Lowest_RSI_ofDay=iRSI(NULL,0,14,PRICE_CLOSE,i);
}
Something like that. Oh and make sure you solve the 0 problem. Lowest_RSI_ofDay is going to initialize as 0 {hint}.
 
ubzen:

Yes. Define a variable called. Lowest_RSI or whatever.

Then add another if(){} one the same level as the RSI line.

Something like that. Oh and make sure you solve the 0 problem. Lowest_RSI_ofDay is going to initialize as 0 {hint}.

HI ubzen .... can u help me to make EA or custom indi showing arrow and alert

Couse I realy don't understand programing, I want to make EA from stochastic (14,3,3)

Here's the rule: Buy if %K <= 10 when candle close of course

sell if %K >=90 TP 10 pips no SL but if not profit

keep laverage every 30 pips with 0.1,0.2,0.4,0.8...lot but change all TP.



Example: Buy GBP/USD 0.1 lot at 1.5997 TP 1.6007 if "she" still go down

laverage 0.2 lot at 1.5967 place both TP at 1.5977 so we got BEP

if not yet profit laverage again 0.4 lot at 1.5937 but don't forget to

change all TP at 1.5957 so we got profit +20 just move TP like

fibonnaci number 1,1,2,3... 10,10,20,30...........


I trade GU M5, I realy hope that you can help me, herylutfy@yahoo.com
 
hery:

Couse I realy don't understand programing, I want to make EA

No slaves here, either learn to code or pay someone.


 

Excellent thank you for the help :)

Antony

Reason: