MAadaptive (rsi)





//+------------------------------------------------------------------+
//|                                             MAadaptive (rsi).mq4 |
//|                                                                  |
//| based on MA adaptive RSI by Perry Kaufman                        |
//+------------------------------------------------------------------+
#property copyright "copyleft mladen"
#property link      "mladenfx@gmail.com"

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Red

//
//
//
//
//

extern int       MA.period = 20;
extern int       MA.price  = PRICE_CLOSE;

//
//
//
//
//

double buffer[];

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
//
//
//
//
//

int init()
{
   SetIndexBuffer(0,buffer);
   return(0);
}
int deinit() { return(0); }

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
//
//
//
//
//

int start()
{
   int      countedBars=IndicatorCounted();
   int      i,limit;

   if (countedBars<0) return(-1);
   if (countedBars>0) countedBars--;
         limit = Bars-countedBars;

   //
   //
   //
   //
   //

      
   for(i = limit; i >=0; i--)
   {
      double price = iMA(NULL,0,1,0,MODE_SMA,MA.price,i);
         if (i>Bars-MA.period)
         {
            buffer[i]=price; continue;
         }
      
      //
      //
      //
      //
      //
      
      double sc = 2.0*MathAbs(iRSI(NULL,0,MA.period,MA.price,i)/100.0-0.5);
      buffer[i] = buffer[i+1] +sc*(price-buffer[i+1]);
   }
   return(0);
}



Sample





Analysis



Market Information Used:



Indicator Curves created:



Indicators Used:

Moving average indicator
Relative strength index


Custom Indicators Used:

Order Management characteristics:

Other Features: