About finding the highest and lowest value of, for example RSI(n) in MQL4!

 

Dear Sir,

I have tried to program an indicator that would average the highest and lowest values of, for example RSI(n) by coding: (buff1_[i] = iHigh(NULL,0,iRSI(NULL,0,IndicatorPeriod,PRICE_CLOSE,i)) , buff2_[i] = iLow(NULL,0,iRSI(NULL,0,IndicatorPeriod,PRICE_CLOSE,i))  and buff3_[i] =(buff1_[i] + buff2_[i])/2, but the slope and the value the code returns is not correct at all. How to do this if were to code the mean for any highest and lowest value of any indicator, Thanks,

                                                                                                                                                                                                                                          Robert Milovic 

 ; 


 
You calculate iRSI outside of that, iHigh and iLow is just the high and low of candles (ohlc). But RSI calculation is known to be lowest at 0 and highest at 100 always, so maybe you want to get the highest and lowest current RSI value on different time periods?
 

Dear Sir,

That is exactly what I want to do!

 
Robbyboby #: That is exactly what I want to do!

So you need to do it. Get each value and test them.

Not tested, not compiled, just typed.
const int iEnd=10; double rsiHH=0, rsiLL=100;
for(int iBeg=0; iBeg < iEnd; ++iBeg){
   double rsi = iRSI(NULL,0,IndicatorPeriod,PRICE_CLOSE,iBeg);
   rsiHH = MathMax(rsiHH, rsi); rsiLL = MathMin(rsiLL, rsi);
}
Not tested, not compiled, just typed.
 

To finish the indicator, I think this is it (file attached)


the red plot is the average of the highest and lowest rsi values


Files:
RSI_multi.mq4  4 kb
 

Dear Sir,

       Thanks a lot for your prompt support. This is mostly what I wanted to achieve and it works perfectly fine. I have already implemented a few other indicators into the code and it worked, cci( with standard deviation and not mean deviation as usual). Thanks a lot!

And what if I were to convert the indicator to MT5 version, as I code only in MQL4 and not MQL5 for now, who to apply to, and how much would it cost me? Thanks, a great job

                                                                                                                                                                                                                               Robert Milovic

 

Dear Sir,

    Thanks a lot, once more, for the MT5 version of the indicator, RSI_multi.mq5. I understand the problem of MT5 conversions you have pointed to, and it stays to check it out on Monday when the market opens, but as much as I have seen the indicator fits perfectly fine for the time being! 

    The main thing I want to check out with you is how possible the conversion of my own coded MT4 EA for news trading is! The EA works great on any news data, trading only the first minute of the release, if the spread is within the appointed scope. And I trade this EA from the copier onto my MT5 live account, but the latency sometimes seems to be about three to four seconds, which is awful. So if there is a possibility for this kind of algorithm to work on MT5 platform I`d be more than delighted to have it. You can test it for yourself to find out that it does not let down. I am sending you the code in MQL4 version, the void on line 1165 and the string from line 1342. Thanks in advance, and you let me know about your opinion and the cost,

                                                                                                                                                                                                                                                        Robert Milovic

 

Dear Sir,

 I haven`t heard from you and haven`t got any comment so far on the opinion for the possibility of the proposed conversion of my MT4 EA to MT5 version. If any additional information needed you let me know! Thanks in advance,

                                                                                                                                                                         Robert Milovic