Moving Average of the RSI Indicator - page 2

 
WHRoeder:
Yes, drag the ma to the subchart and select previous/first indicator for price.

Hi WHRoeder !

Tried but it doesn`t work on my platform. Could it be done with including it in the code written by deVries.

 
deVries:

for coding use SRC

This will do it....

Hello deVries, good day.

How could I use this indicator to visualize it on an EA? I would like to check the value of the MA of RSI; would it be using iCustom function?

Best regards and thank you,

codeMolecules 

 
codeMolecules: I would like to check the value of the MA of RSI; would it be using iCustom function?
How else can you get custom indicator buffer values? Detailed explanation of iCustom - MQL4 forum
 

All this is not the same

if you take an RSI and then the ma of this RSI, you get an Smoothed RSI

Buy you can take any MA, and then his RSI, then you get an RSI of MA:

    for(int i=limit; i>=0; i--) MA[i]           = iMA(NULL,0,Per,0,Meth, Prix,i );
    for(int i=limit; i>=0; i--) RSI_Of_MA[i]    = iRSIOnArray(MA,0,rsi_off_ma,i);

The green is the RSI of MA ;


Files:
 
Gerardo Bustos:

Hello deVries, good day.

How could I use this indicator to visualize it on an EA? I would like to check the value of the MA of RSI; would it be using iCustom function?

Best regards and thank you,

codeMolecules 

There is no percentage for SMA although it can fit in same space within rsi window in android phone.But I guess this pseudocode function for SMA10 to read off as percentage. I havent applied it so let let me know how it goes

getPercentageSMA( currentprice)
{
Double highestPrice= search the highest price in last 10 days (treat as 100%)
Double lowestPrice= search the lowest price in last 10 days (treat as 0%)
Double Currentpercentage= extrapolate currentprice to find the in between percentage
Return Currentpercentage
}
 
Tjipke de Vries:

for coding use SRC

This will do it....

You forgot some brackets

I have fixed it and made pretty :)

//+------------------------------------------------------------------+
//|                                                  MAofRSIv1.0.mq4 |
//|                    Copyright 2020, Ryan Ross and Tjipke de Vries |
//|             https://www.mql5.com/en/forum/137619#comment_3484228 |
//+------------------------------------------------------------------+
#property copyright "Copyright 2020, Ryan Ross and Tjipke de Vries"
#property link "https://www.mql5.com/en/forum/137619#comment_3484228"
#property version "1.00"
#property strict
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_minimum 0
#property indicator_maximum 100
#property indicator_color1 Black //RSI color
#property indicator_color2 Green
#property indicator_level1 32 //SetLevelValue(0,50);
#property indicator_level2 50 //SetLevelValue(1,68);
#property indicator_level3 68 //SetLevelValue(2,32);
#property indicator_levelcolor DimGray //color indicator value
//--- input parameters
extern int RSI_Period = 14; //Period of RSI
extern ENUM_APPLIED_PRICE RSI_Price = 0; //Applied price of MA onto RSI
extern int RSI_MA_Period = 100; //Period of MA upon RSI
extern ENUM_MA_METHOD RSI_MA_Type = 1; //Type of MA
//--- buffers
double RSIBuf[];
double MaBuf[];
int init()
{
    IndicatorShortName("MA of the RSI");
    //---- drawing settings  RSI  (0,......)
    SetIndexBuffer(0, RSIBuf);
    SetIndexLabel(0, "RSI"); //SetIndexLabel(0,NULL); wrong
    SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 1); //SetIndexStyle(0,DRAW_NONE);wrong this is draw nothing
    //---- drawing settings of Moving Average on RSI
    SetIndexBuffer(1, MaBuf);
    SetIndexLabel(1, " (" + IntegerToString(RSI_MA_Period) + ") Period MA of RSI"); //SetIndexLabel(1,"MA of the RSI");
    SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, 1); //SetIndexStyle(1,DRAW_LINE);
    //SetLevelValue(0,50);
    //SetLevelValue(1,68);
    //SetLevelValue(2,32);
    //SetLevelStyle(STYLE_DOT,1,DimGray);
    return (0);
}
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int start()
{
    double MA, RSI[];
    ArrayResize(RSI, RSI_MA_Period);
    int counted_bars = IndicatorCounted();
    int limit = Bars - counted_bars - 1;
    for (int i = limit; i >= 0; i--)
    {//This brace was missing
        RSIBuf[i] = (iRSI(NULL, 0, RSI_Period, RSI_Price, i));
        MA = 0;
        for (int x = i; x < i; x++)
        {
            RSI[x - i] = RSIBuf[x];
            MA += RSIBuf[x] / RSI_MA_Period;
        }
    }//This one too :) /agentrfr
    for (int j = limit; j >= 0; j--) //was missing
    {
        MaBuf[j] = (iMAOnArray(RSIBuf, 0, RSI_MA_Period, 0, RSI_MA_Type, j));
    }
    //----
    return (0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
    //----
    //----
    return (0);
}
//+------------------------------------------------------------------+
 

Hello everyone i was going through a solution for MA on RSI because i have a strategy that work on XAUUSD. 

But after this code in the above post i need help to prepare values of both MA and RSI to generate buy and sell orders. anyone please help me out with this.


	          
Reason: