# RSI current Tick value

Hi everybody,

Im developing an EA, but i' having trouble at understanding how I can get the value of the RSI at the current Tick.

Im using the iRSI function, and I'm able to get values out of it. The problem is that I need the RSI value of the current tick and not of the last closed bar. Do you know if there any way to get it?

Thanks!

fraccaman :

Hi everybody,

Im developing an EA, but i' having trouble at understanding how I can get the value of the RSI at the current Tick.

Im using the iRSI function , and I'm able to get values out of it. The problem is that I need the RSI value of the current tick and not of the last closed bar. Do you know if there any way to get it?

Thanks!

Just ask for the iRSI indicator values from the current bar - at each moment in time, the indicator on the current bar will show the latest value.

This is how the adviser works now: we check the signal ONLY AT THE MOMENT OF THE BIRTH OF A NEW BAR. The new bar has index # 0, we call the new bar "Current Bar". Example of a BUY signal: if the two previous bars (bar # 1 and bar # 2) are below the '30' line, this is a BUY signal:

Pic. 1. iRSI simple advisor, version1.006

The code:

```//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
{
//--- we work only at the time of the birth of new bar
datetime time_0=iTime(Symbol(),Period(),0);
if(time_0==m_prev_bars)
return;
m_prev_bars=time_0;
//---
double rsi_2=iRSIGet(2);
double rsi_1=iRSIGet(1);
if(rsi_2==EMPTY_VALUE || rsi_1==EMPTY_VALUE)
return;
//---
if(rsi_2>Inp_RSI_Level_UP && rsi_1>Inp_RSI_Level_UP)
else if(rsi_2<Inp_RSI_Level_DOWN && rsi_1<Inp_RSI_Level_DOWN)
}```

• 2020.03.12
• www.mql5.com
This thread discusses MQL5 code examples. There will be examples of how to get data from indicators, how to program advisors...

Thank you! Works like a charm!

Have a good day!

Hello,

I need this please but when I tried it I got iRSIGet function not defined, please advice

Reason: