MQL4 Learning - page 126

 

thank you ,

 

Dear Mladen;

Is there a way to identify/define high and low points of indicator for previous day such as rsi higher and lower point of yesterday ;

 
kemal44:
Dear Mladen; Is there a way to identify/define high and low points of indicator for previous day such as rsi higher and lower point of yesterday ;

In general yes

Simply fill a buffer with values you wish to check for highs and lows and then using ArrayMaximum() and ArrayMinimum() function you can find minimums and maximums for the desired period (number of bars)

 

thank you;

 

int CheckRSI()

{

rsi[shift]=iRSI(NULL,PERIOD_D1,13,PRICE_LOW,shift);

rsi11[shift]=rsi[ArrayMinimum(rsi,13,shift)];

rsi22[shift]=rsi[ArrayMaximum(rsi,13,shift)];

rsi1[shift]=iRSI(NULL,0,13,PRICE_LOW,shift);

rsi2[shift]=iRSI(NULL,0,13,PRICE_LOW,shift+1);

if(rsi1[shift]>rsi11[shift] && rsi2[shift]<rsi11[shift])

return(1); //buy

if(rsi1[shift]>rsi22[shift] && rsi2[shift]<rsi22[shift])

return(2); //sell

return(0);

}

//+------------------------------------------------------------------+

Hi Mladen ;

sorry for any inconvenience;

Above code ,It just did make sell function;

did I make any misketake writting code?

 
kemal44:
int CheckRSI()

{

rsi[shift]=iRSI(NULL,PERIOD_D1,13,PRICE_LOW,shift);

rsi11[shift]=rsi[ArrayMinimum(rsi,13,shift)];

rsi22[shift]=rsi[ArrayMaximum(rsi,13,shift)];

rsi1[shift]=iRSI(NULL,0,13,PRICE_LOW,shift);

rsi2[shift]=iRSI(NULL,0,13,PRICE_LOW,shift+1);

if(rsi1[shift]>rsi11[shift] && rsi2[shift]<rsi11[shift])

return(1); //buy

if(rsi1[shift]>rsi22[shift] && rsi2[shift]<rsi22[shift])

return(2); //sell

return(0);

}

//+------------------------------------------------------------------+

Hi Mladen ;

sorry for any inconvenience;

Above code ,It just did make sell function;

did I make any misketake writting code?

Kemal44, maybe try changing price in rsi,rsi1, and rsi2 to PRICE_CLOSE, other wise think your very close.

 

same result , it didnt make a long order

maybe you can write a fibo rsi for us

 
kemal44:
same result , it didnt make a long order maybe you can write a fibo rsi for us

Something not quite right here

if(rsi1[shift]>rsi11[shift] && rsi2[shift]<rsi11[shift])

return(1); //buy

if(rsi1[shift]>rsi22[shift] && rsi2[shift]<rsi22[shift])

return(2); //sell

not sure what your trying to do, but if your trying to buy after a breakout up of the lower rsi minumum, that part should be right (your buy call)

and if your trying to trade a breakout of the maximum rsi down then your sell should be the opposite of what you have

if(rsi1[shift]rsi22[shift])

return(2); //sell

 

if current rsi breakout down to max , signal=sell signal

if current breakout up to min ; signal =buy signal

above definition just made a sell order , I am not sure what is wrong with min breakout up ;

 
kemal44:
int CheckRSI()

{

rsi[shift]=iRSI(NULL,PERIOD_D1,13,PRICE_LOW,shift);

rsi11[shift]=rsi[ArrayMinimum(rsi,13,shift)];

rsi22[shift]=rsi[ArrayMaximum(rsi,13,shift)];

rsi1[shift]=iRSI(NULL,0,13,PRICE_LOW,shift);

rsi2[shift]=iRSI(NULL,0,13,PRICE_LOW,shift+1);

if(rsi1[shift]>rsi11[shift] && rsi2[shift]<rsi11[shift])

return(1); //buy

if(rsi1[shift]>rsi22[shift] && rsi2[shift]<rsi22[shift])

return(2); //sell

return(0);

}

//+------------------------------------------------------------------+

Hi Mladen ;

sorry for any inconvenience;

Above code ,It just did make sell function;

did I make any misketake writting code?

kemal44

I don't see where do you fill the rsi array? In that code only one value is assigned to it

Reason: