RSI of MA, is this correct?

Back to topics list To post a new topic, please log in or register
avatar
32
paranoyakX 2016.07.19 11:08
 

Hello,

 

I want to measure RSI of MA. I found this code from code base and try to modify it, is this give me the correct result ? or is this the correct way to do it (because I believe it is not)?

My next goal is try to do it RSI of Any indicator data. I saw some indicators can be applied to previous indicator etc.

thanks,

 

 

#property indicator_separate_window
#property indicator_buffers 2       
#property indicator_color1 Blue     
#property indicator_color2 Red    

extern int xRSIPeriod = 14;
extern int xMAPeriod = 20;

double Buf_0[],Buf_1[];            
//--------------------------------------------------------------------
int init()                         
  {
//--------------------------------------------------------------------
   SetIndexBuffer(0,Buf_0);        
   SetIndexStyle (0,DRAW_NONE,STYLE_SOLID,2);
   
   
//--------------------------------------------------------------------
   SetIndexBuffer(1,Buf_1);         
   SetIndexStyle (1,DRAW_LINE,STYLE_DOT,1);
//--------------------------------------------------------------------
   return;                         
  }
//--------------------------------------------------------------------
int start()                        
   int i=0,                           
       Counted_bars;               
//--------------------------------------------------------------------
   Counted_bars=IndicatorCounted();

   
   i=Bars-Counted_bars-1;          
   while(i>=0)                     
     {

      Buf_0[i]=iMA(Symbol(), PERIOD_CURRENT, xMAPeriod,0, MODE_SMA, PRICE_CLOSE, i);            
      Buf_1[i]=iRSIOnArray(Buf_0,0,xRSIPeriod,i);              
      
      i--;                          
     }   
//--------------------------------------------------------------------
   return;                         
  }
//--------------------------------------------------------------------
avatar
32
paranoyakX 2016.07.19 21:23 #
 

any idea guys ?

 

by the way when I try to put this indicator on a char M30 or bigger, it waits about 10 minutes. 

avatar
12985
WHRoeder 2016.07.19 21:30 #
 
  1. Buf_0[i]=iMA(Symbol(), PERIOD_CURRENT, xMAPeriod,0, MODE_SMA, PRICE_CLOSE, i);            
    Buf_1[i]=iRSIOnArray(Buf_0,0,xRSIPeriod,i);              

    Do you know what an RSI is? RS = Average( positive values ) / Average( negative values );  RSI = 100 - 100/(1 + RS);

    The MA has no negative values, therefor RSI will ALWAYS be 100.


  2. What do you think you'll see when you put line in the [100..-100] range on a price chart with the range (0.8609..0.82400)
avatar
32
paranoyakX 2016.07.20 08:09 #
 

Hi WHRoeder,

 

yes I know, but what when I put this indicator on a chart not all the values are 100. there is graphic, then what is that graphic. I would like to measure strength of MA, thats why I am trying to do this.  

Back to topics list  

To add comments, please log in or register