//+------------------------------------------------------------------+
//| Momentum Pinball Indicator.mq4 |
//| FX Maratha |
//| Free to use and modify for all aspiring and established traders |
//+------------------------------------------------------------------+
#property copyright "FX Maratha"
#property link "Free to use and modify for all aspiring and established traders"

#property indicator_separate_window
#property indicator_minimum 0
#property indicator_maximum 100
#property  indicator_level1 70
#property  indicator_level2 30
#property indicator_buffers 3
#property indicator_color1 Red
#property indicator_color2 RoyalBlue
#property indicator_color3 RoyalBlue
//---- input parameters
extern int ROC_Period=1;
extern int RSI_Period=3;
//---- buffers
double ROC[];
double RSIonROC[],count[];

double MediumRS[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators


   IndicatorBuffers(3);
   
   SetIndexStyle(0,DRAW_NONE);
   SetIndexBuffer(0,ROC);
   
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,RSIonROC);

   SetIndexBuffer(2, MediumRS);
   SetIndexStyle(2, DRAW_ARROW);
   SetIndexArrow(2, 233);







//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
  {
//----

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
  {


   int i,counted_bars=IndicatorCounted();
   if(counted_bars<0)
      return(-1);
   if(counted_bars>0)
      counted_bars--;
   int limit = fmin(Bars-counted_bars,Bars-1);
 

   for(i=limit; i>=0; i--)
     {

      ROC[i]=iClose(NULL,0,i)-iClose(NULL,0,i+ROC_Period);

      RSIonROC[i]=iRSIOnArray(ROC,Bars,RSI_Period,i);

      if(RSIonROC[i+1] > 30 && RSIonROC[i+1] <70) MediumRS[i+1] = RSIonROC[i+1];

      

     }


   return(0);
  }
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
