//+------------------------------------------------------------------+
//|                                                   Fire Power.mq4 |
//+------------------------------------------------------------------+

#property indicator_separate_window
#property  indicator_buffers 4
#property  indicator_color1  clrBlue
#property  indicator_color2  clrRed
#property  indicator_width1  2
#property  indicator_width2  2

//---- indicator buffers
int        prev_bar;
extern int PricePower1 = 7;
extern int PricePower2 = 14;
extern int PricePower3 = 20;
extern int PricePower4 = 50;


double     buffer1[];
double     buffer2[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()  {
//---- drawing settings
  
   SetIndexBuffer(0,buffer1);
   SetIndexStyle(0,DRAW_LINE);
   SetIndexDrawBegin(0,0);
   
   
   
   SetIndexBuffer(1,buffer2);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexDrawBegin(1,0);
   
      
      
  IndicatorShortName("Fire Power");
  for(int i=0; i<=Bars; i++)  {
    buffer1[i] = (High[i]-Low[i])/Point;
    buffer2[i] = (High[i]-Low[i])/Point;
      
  }  
  prev_bar = -99;
  return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()  {
  return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()  {



      
  if (Time[0] != prev_bar)  {
    for(int i=0; i<=Bars; i++)  {
      double MA1=iCustom(NULL,0,"Bear_Bulls_Power",PricePower1,0,i);
      double MA2=iCustom(NULL,0,"Bear_Bulls_Power",PricePower2,0,i);
      double MA3=iCustom(NULL,0,"Bear_Bulls_Power",PricePower3,0,i);
      double MA4=iCustom(NULL,0,"Bear_Bulls_Power",PricePower4,0,i);
      
      buffer1[i] = ((MA1+MA2)+(MA2+MA3)+(MA3+MA4)/Point);
      
      double MA5=iCustom(NULL,0,"Bear_Bulls_Power",PricePower1,1,i);
      double MA6=iCustom(NULL,0,"Bear_Bulls_Power",PricePower2,1,i);
      double MA7=iCustom(NULL,0,"Bear_Bulls_Power",PricePower3,1,i);
      double MA8=iCustom(NULL,0,"Bear_Bulls_Power",PricePower4,1,i);
      
      buffer2[i] = ((MA5+MA6)+(MA6+MA7)+(MA7+MA8)/Point);
      
  } }
  prev_bar = Time[0];
  return(0);
      

}
//+------------------------------------------------------------------+
