How to add a moving average to RMI (relative momentum index) through code?

 

Hi everyone, I have been reading this forum for a while, and it has been very helpful. I am in the process of learning to code MT5 indicators.

I learned that adding a moving average to an RSI is easy. I just need to point to the RSI handle for the MA handle. However, this is not true of the RMI indicator.

I tried without success to add the moving average to the RMI line. I wonder where I did wrong. Can you help me troubleshoot the error? Thanks in advance.

Moving Average - Trend Indicators - Technical Indicators - Price Charts, Technical and Fundamental Analysis - MetaTrader 5 Help
Moving Average - Trend Indicators - Technical Indicators - Price Charts, Technical and Fundamental Analysis - MetaTrader 5 Help
  • www.metatrader5.com
The Moving Average Technical Indicator shows the mean instrument price value for a certain period of time. When one calculates the moving average...
Files:
 
Pauper31: However, this is not true of the RMI indicator.

Of course not. That indicator does not have one output buffer.

 
William Roeder #:

Of course not. That indicator does not have one output buffer.

Hi sir. Thanks a lot for your response. I have learned a lot from you over the years.

I tried to find a solution to the problem. I hope you can look into the code and provide me feedback.

***

 
Pauper31 # :

Hi sir. Thanks a lot for your response. I have learned a lot from you over the years.

I tried to find a solution to the problem. I hope you can look into the code and provide me feedback.

***

Remember you write in the MQL5 section! In this section, MQL5 code is discussed and posted. According to the MQL5 style, the indicator handle must be created ONCE! And you need to do this in OnInit!

 
Pauper31 :

Hi everyone, I have been reading this forum for a while, and it has been very helpful. I am in the process of learning to code MT5 indicators.

I learned that adding a  moving average  to an RSI is easy. I just need to point to the RSI handle for the MA handle. However, this is not true of the RMI indicator.

I tried without success to add the moving average to the RMI line. I wonder where I did wrong. Can you help me troubleshoot the error? Thanks in advance.

What is 'RMI'? Is this a standard indicator?

 
Vladimir Karputov #:

What is 'RMI'? Is this a standard indicator?

It stands for Relative Momentum Index. I have an MQL4 version of this indicator. The concept is analogous to RSI.
 
Pauper31 #:
It stands for Relative Momentum Index. I have an MQL4 version of this indicator. The concept is analogous to RSI.

Search CodeBase for 'RMI' and you will find the MQL5 version

 
Vladimir Karputov #:

Search CodeBase for 'RMI' and you will find the MQL5 version


I have the MQL5 version, but I want to add a moving average like the one I have for MQL4.
 
Pauper31 # :
I have the MQL5 version, but I want to add a moving average like the one I have for MQL4.

Create an 'RMI' handle, then set the 'RMI' handle instead of the price when creating the iMA handle.

 

Example:

Files:
MA_on_RMI.mq5  19 kb
 
Vladimir Karputov #:

Example:

The code looks great. However, it returns the following errors:

Errors