//+------------------------------------------------------------------+
//|                                                 ExpertZigzag.mq4 |
//|                      Copyright © 2007, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.ru/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.ru/"

int zigCounter;
// test on move "Open Prices" only
//+------------------------------------------------------------------+
//|  Set arrow                                                       |
//+------------------------------------------------------------------+
void SetArrow(datetime _time,double _price,string _Description ,int _arrowType, color _arrowColor)
   {
   ObjectCreate(_Description,OBJ_ARROW,0,_time,_price);
   ObjectSet(_Description,OBJPROP_ARROWCODE,_arrowType);
   ObjectSet(_Description,OBJPROP_COLOR,_arrowColor);
   }


//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
  double ZigZag;
  int cnt;
  
   cnt=1;
   ZigZag=iCustom(Symbol(),Period(),"ZigZag",0,cnt);
   if (ZigZag>0.0) 
      {
      SetArrow(Time[cnt],ZigZag,zigCounter,159,Blue);
      zigCounter++;
      }
   return(0);
  }