//+------------------------------------------------------------------+
//|                                   Candle based vertical line.mq4 |
//+------------------------------------------------------------------+
#property indicator_chart_window

#include <hanover --- function header (np).mqh>

extern int      CandleNumber          = 10;
extern color    LineColor             = Gray;
extern int      LineWidth             = 1;
extern int      LineStyle             = STYLE_SOLID;

string   IndiName = "@CBVL-";

//+------------------------------------------------------------------+
int init()  {
//+------------------------------------------------------------------+
  return(0);
}

//+------------------------------------------------------------------+
int deinit()  {
//+------------------------------------------------------------------+
  del_obj();
  return(0);
}

//+------------------------------------------------------------------+
int start()   {
//+------------------------------------------------------------------+
  PlotVL    (IndiName+NumberToStr(1,"'-'Z6"), false, 0, Time[CandleNumber], LineColor, LineWidth, LineStyle, false, 0, "");      // Plot vertical line
  return(0);
}

//+------------------------------------------------------------------+
void del_obj()  {
//+------------------------------------------------------------------+
  int k=0;
  while (k<ObjectsTotal())   {
    string objname = ObjectName(k);
    if (StringSubstr(objname,0,StringLen(IndiName)) == IndiName)  
      ObjectDelete(objname);
    else
      k++;
  }    
  return(0);
}

//+------------------------------------------------------------------+
#include <hanover --- extensible functions (np).mqh>

