# UltraRSI Indicator For MT5

The UltraRSI Indicator For MT5 is a superb indicator for measuring and displaying the strength of an asset during its respective bullish and bearish trending periods in the market - at first glance the oscillator is setup in an abnormal manner which most traders are not accustomed to, having said that though it still makes for easy interpretation. This indicator is an advanced version of the normal Relative Strength Index whereby the trader has up to ten different options to choose from to define its smoothing algorithm however the resulting oscillation is not in a form of a line but rather in the form of two different colored clouds which serves as a trend direction indicator and as a trend strength barometer. The blue cloud is for bullish periods in the market and the pink clouds are for bearish periods in the market which is great and therefore traders should look to capitalizing on their use of this indicator because the size of the width of the respective clouds clearly defines the exit and entry points for the trader. So when a new trend forms - as confirmed by the color change of the two clouds - the trader may decide to open a trade at that point after which the cloud will expand in width in direct proportion to the trend-strength and then it will contract and decrease in width - once the cloud has decreased almost completely in width then the trader may close the trade which they are in.

## Installing the UltraRSI Indicator For MT5

After you downloaded the indicator via the form above you need to unzip the zip-file. Then you need to copy the file ultrarsi.mq5 into the folder MQL5\Indicators of your MT5 installation. After that please restart MT5 and then you will be able to see the indicator in the list of indicators.

## Parameters of the UltraRSI Indicator For MT5

The UltraRSI Indicator For MT5 has 16 parameters to configure.

```
input int RSI_Period=13; // RSI indicator period
input ENUM_APPLIED_PRICE Applied_price=PRICE_CLOSE; // Applied price
input Smooth_Method W_Method=MODE_JJMA; // Smoothing method
input int StartLength=3; // Initial smoothing period
input int WPhase=100; // Smoothing parameter
input uint Step=5; // Period change step
input uint StepsTotal=10; // Number of period changes
input Smooth_Method SmoothMethod=MODE_JJMA; // Smoothing method
input int SmoothLength=3; // Smoothing depth
input int SmoothPhase=100; // Smoothing parameter
input uint UpLevel=80; // Overbought level, %%
input uint DnLevel=20; // Oversold level, %%
input color UpLevelsColor=Blue; // Overbought level color
input color DnLevelsColor=Blue; // Oversold level color
input STYLE Levelstyle=DASH_; // Levels style
input WIDTH LevelsWidth=Width_1; // Levels width
```

## Buffers of the UltraRSI Indicator For MT5

The UltraRSI Indicator For MT5 provides 2 buffers.

```
SetIndexBuffer(0,BullsBuffer,INDICATOR_DATA);
SetIndexBuffer(1,BearsBuffer,INDICATOR_DATA);
```

## Main Parts Of The Code

```
int OnCalculate(const int rates_total, // number of bars in history at the current tick
const int prev_calculated,// number of bars calculated at previous call
const datetime &time[],
const double &open[],
const double& high[], // price array of maximums of price for the indicator calculation
const double& low[], // price array of minimums of price for the indicator calculation
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
//---- checking the number of bars to be enough for the calculation
if(BarsCalculated(RSI_Handle) lt rates_total
|| rates_total lt min_rates_total)
return(RESET);
//---- declaration of local variables
int to_copy,limit,bar,maxbar1,maxbar2;
double RSI[],upsch,dnsch;
//---- calculation of maxbar initial index for the XMASeries() function
maxbar1=rates_total-1-min_rates_wpr;
maxbar2=rates_total-1-min_rates_xma;
//---- calculation of the limit starting index for the bars recalculation loop
if(prev_calculated gt rates_total || prev_calculated lt =0)// checking for the first start of the indicator calculation
limit=maxbar1; // starting index for calculation of all bars
else limit=rates_total-prev_calculated; // starting index for calculation of new bars
//----
to_copy=limit+2;
//--- copy newly appeared data in the arrays
if(CopyBuffer(RSI_Handle,0,0,to_copy,RSI) lt =0) return(RESET);
//---- indexing elements in arrays as time series
ArraySetAsSeries(RSI,true);
//---- main indicator calculation loop
for(bar=limit; bar gt =0 && !IsStopped(); bar--)
{
for(int sm=int(StepsTotal); sm gt =0 && !IsStopped(); sm--)
xwpr0[sm]=XMA[sm].XMASeries(maxbar1,prev_calculated,rates_total,W_Method,WPhase,period[sm],RSI[bar],bar,true);
if(bar gt maxbar2)
{
if(bar) ArrayCopy(xwpr1,xwpr0,0,0,WHOLE_ARRAY);
continue;
}
upsch=0;
dnsch=0;
for(int sm=int(StepsTotal); sm gt =0 && !IsStopped(); sm--)
if(xwpr0[sm] gt xwpr1[sm]) upsch++;
else dnsch++;
BullsBuffer[bar]=XMA[StTot1].XMASeries(maxbar2,prev_calculated,rates_total,SmoothMethod,SmoothPhase,SmoothLength,upsch,bar,true);
BearsBuffer[bar]=XMA[StTot2].XMASeries(maxbar2,prev_calculated,rates_total,SmoothMethod,SmoothPhase,SmoothLength,dnsch,bar,true);
if(bar) ArrayCopy(xwpr1,xwpr0,0,0,WHOLE_ARRAY);
}
//----
return(rates_total);
}
//+------------------------------------------------------------------+
```