//+------------------------------------------------------------------+
//|zMarkHorizontalsDN1 mq4                                           |
//|Marks horizontals starting at an input price (pivot point)        |
//|and places 7 parallel lines below it                              |
//|08/19/09 initial                                                  |
//|09/11/09 cosmetic                                                 |
//+------------------------------------------------------------------+
#property copyright "z"
#property link      "z"
#property  indicator_chart_window
#property indicator_buffers 8
#property indicator_color1 Yellow
#property indicator_color2 Yellow
#property indicator_color3 Yellow
#property indicator_color4 Yellow
#property indicator_color5 Yellow
#property indicator_color6 Yellow
#property indicator_color7 Yellow
#property indicator_color8 Yellow

extern double dPivotPoint=0;
extern double dGridSize=0;

double PPBuf[],DN1Buf[],DN2Buf[],DN3Buf[],DN4Buf[],DN5Buf[],DN6Buf[],DN7Buf[];
bool bKillIt=False;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init() {
   SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2);
   SetIndexBuffer(0,PPBuf); 
   SetIndexLabel(0,"pp");
   SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1);
   SetIndexBuffer(1,DN1Buf); 
   SetIndexStyle(2,DRAW_LINE,STYLE_SOLID,1);
   SetIndexBuffer(2,DN2Buf); 
   SetIndexStyle(3,DRAW_LINE,STYLE_SOLID,1);
   SetIndexBuffer(3,DN3Buf); 
   SetIndexStyle(4,DRAW_LINE,STYLE_SOLID,1);
   SetIndexBuffer(4,DN4Buf); 
   SetIndexStyle(5,DRAW_LINE,STYLE_SOLID,1);
   SetIndexBuffer(5,DN5Buf); 
   SetIndexStyle(6,DRAW_LINE,STYLE_SOLID,1);
   SetIndexBuffer(6,DN6Buf); 
   SetIndexStyle(7,DRAW_LINE,STYLE_SOLID,1);
   SetIndexBuffer(7,DN7Buf);    
   if( (dPivotPoint==0) || (dGridSize==0) ) {
      Print("Missing input value.");
      bKillIt=true;  
   }
   return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start() {
   if(bKillIt==true) return(-1);
   int i,counted_bars=IndicatorCounted();
      if(counted_bars>0) counted_bars--;
   int limit=Bars-counted_bars;
   for(i=0; i<limit; i++)
   {
      PPBuf[i] = dPivotPoint;
      DN1Buf[i] = dPivotPoint - dGridSize;
      DN2Buf[i] = dPivotPoint - (2.0 * dGridSize);
      DN3Buf[i] = dPivotPoint - (3.0 * dGridSize);
      DN4Buf[i] = dPivotPoint - (4.0 * dGridSize);
      DN5Buf[i] = dPivotPoint - (5.0 * dGridSize);
      DN6Buf[i] = dPivotPoint - (6.0 * dGridSize);
      DN7Buf[i] = dPivotPoint - (7.0 * dGridSize);
   }
   return(0);
}   
//+------------------------------------------------------------------+