the strange error message INF0000

 

here is my indicator code i tried to create, and it doesn't work. please help me find out what is the matter with the code.

here is the code

//+------------------------------------------------------------------+
//|                                                  PriceZigzag.mq4 |
//|                       Copyright ?2009, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright ?2009, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Red
//---- input parameters
extern int       pipstep=20;
//---- buffers
double ExtMapBuffer1[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_SECTION);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexEmptyValue(0,0.0);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
double last;
int start()
  {
   int    counted_bars=IndicatorCounted();
//----
      int limit;

//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;

limit = Bars - counted_bars-1;

//  ExtMapBuffer1[limit] = last;
last =Open[limit];

   for(int i=limit-1; i>=0; i--)
      {
    
    //  if(i== limit) last = Open[limit];

   //   if(last <= Low[i])
     //    if((last+ pipstep*Point< High[i] && last+ pipstep*Point> Low[i] ) || Low[i]> last+pipstep*Point)
      double a,b;
  
       if( Low[i]-last>1*pipstep*Point )
         {
          
         
          a= (Low[i]-last)/(pipstep*Point);
          b= (High[i]-last)/(pipstep*Point);
         
         if(last+b*pipstep*Point-Close[i]>=Close[i]-a*pipstep*Point-last)
         ExtMapBuffer1[i] = last+a*pipstep*Point;
         else
         ExtMapBuffer1[i] = last+b*pipstep*Point;
         
         last = ExtMapBuffer1[i];
         
         }
  //    if(last>=High[i])
       else  if(last-High[i]>1*pipstep*Point )
               {
   
          a= (last-Low[i])/Point/pipstep;
          b= (last-High[i])/Point/pipstep;
         Print(i+"|"+a);
      
         if(last-b*pipstep*Point-Close[i] >=Close[i]-(last-a*pipstep*Point))
         ExtMapBuffer1[i] = last+a*pipstep*Point;
         else
         ExtMapBuffer1[i] = last+b*pipstep*Point;
         
         last = ExtMapBuffer1[i];
         }

     
      
    }
   return(0);
  }
//+------------------------------------------------------------------+

the code of this indicator try to draw a line looks like zigzag. but is not same as the zigzag. this indicator start from the fisrt bar, and set the firstbar's openprice as the first price point. from left to right, if the next bar is over the first point above pipstep point, we will draw that point, some time the price bar may contain over 1 points that is over pipstep point. then we will choose the point wich is near the close price.

example the first open price that is the fisrt point of the indicator too, is 1.000 if the next bar is high 1.030 low 1.010 pipstep is 20. then this bar 's indicator's value will be 1.020.

if the next bar is high 1.001 low 1.010 the bar's indicator's value will be nothing.

if the next bar is high 1.0067 low 1.0020 then we will find out which point is near close price. if close price is 1.0060, then the indicator's value will be 1.0060 if the close price is 1.0042 then we will set the indicator's value 1.0040. please reference my code and understand it. if you need more information please post .

thank s for any help.

 
I don't understand why do you so complicate everything, for example:
          a= (Low[i]-last)/(pipstep*Point);
          b= (High[i]-last)/(pipstep*Point);
         
         if(last+b*pipstep*Point-Close[i]>=Close[i]-a*pipstep*Point-last)
         ExtMapBuffer1[i] = last+a*pipstep*Point;
         else
         ExtMapBuffer1[i] = last+b*pipstep*Point;
	
you could code as:
         if(High[i]-Close[i]>=Close[i]-Low[i])
         ExtMapBuffer1[i] = Low[i];
         else
         ExtMapBuffer1[i] = High[i];
 
Roger wrote >>
I don't understand why do you so complicate everything, for example:
you could code as:

thank you. but i don't want that like your code.

please read the text below the code,that can make you understand what i want to do.

thank you.

Reason: