Help on RSI please.

 

Can any one teach me how can I create EMA on RSI and draw the EMA on RSI itself, thus there will be two lines on the same window.

I did this but it is not working (syntax is fine, but funcionaility failes):


iMA(NULL,0,3,0,MODE_EMA,iRSI(NULL,0,12,PRICE_CLOSE,0),0);



**Also, please put in the link where I could find the generic help, I wish to change color and weight of the RSI line, also want to add two typical horizontal lines



Thanks.
 
Create a series array of the RSI values you want to smooth and use iMAOnArray()
 
phy:
Create a series array of the RSI values you want to smooth and use iMAOnArray()

Phy, I thank you.

Is it Ok if I ask you for a sample snip?

i could not understand iMAOnArray()


I would appreciate if you tell me how it works, but I should be able to understand via your code aswell


Thanks.

 
Fire:

Phy, I thank you.

Is it Ok if I ask you for a sample snip?

i could not understand iMAOnArray()


I would appreciate if you tell me how it works, but I should be able to understand via your code aswell


Thanks.

I did this but I could not get it

iMAOnArray(iRSI(NULL,0,12,PRICE_CLOSE,0),1,3,0,MODE_EMA,0);

 
See as example MACD custom indicator. Signal line is moving average calculated on array of differences between 2 MAs. Fill this array with RSI values instead of calculated differences
 

hope this will help you,

//+------------------------------------------------------------------+
//| RSIarray.mq4|
//| |
//| |
//+------------------------------------------------------------------+
#property copyright ""
#property link ""

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Blue
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
extern int MAperiod=10;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,ExtMapBuffer2);
//----
return(0);
}

//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int limit;
int counted_bars=IndicatorCounted();
//---- last counted bar will be recounted
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
//----
for(int i=0; i<limit; i++)
ExtMapBuffer1[i]=iRSI(NULL,0,14,PRICE_CLOSE,i);
for(i=0; i<limit; i++)
ExtMapBuffer2[i]=iMAOnArray(ExtMapBuffer1,Bars,MAperiod,0,MODE_SMA,i);
//----
//----
return(0);
}
//+------------------------------------------------------------------+


Files:
rsiarray.mq4  2 kb
 

There is SRC button in the integrated editor

to show
   formatted
            text
 
stringo wrote >>

There is SRC button in the integrated editor

I thank you very much, this will form a base example for me.

When I run this code, I got an error, it says "SetIndexBuffer function must be called from custom indicator only".

May we get in sync, we are trying to create a window, in it we will have (1)RSI and (2)EMA of the RSI (3)two horizontal lines right?

But I want to get a working example so that I will be able to twitch to find the reaction of the code.

Again I thank you.

 
Fire:

I thank you very much, this will form a base example for me.

When I run this code, I got an error, it says "SetIndexBuffer function must be called from custom indicator only".

May we get in sync, we are trying to create a window, in it we will have (1)RSI and (2)EMA of the RSI (3)two horizontal lines right?

But I want to get a working example so that I will be able to twitch to find the reaction of the code.

Again I thank you.

Can Anyone please help me, thanks.

 

"SetIndexBuffer function must be called from custom indicator only"

Sounds like you are trying to add indexes to an EA or Script. Can't do that.

 
phy:

"SetIndexBuffer function must be called from custom indicator only"

Sounds like you are trying to add indexes to an EA or Script. Can't do that.

Phy,

My intention, I want to add one more window, in it I will have RSI and an EMA of the RSI in the RSI window.

Is this possible?

Reason: