//+------------------------------------------------------------------+
//|                                                 FXPT_MarkBar.mq4 |
//|                                         Developed by fxprotrader |
//|                                     http://www.fxpro-trader.com" |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2012, fxprotrader"
#property link      "http://www.fxpro-trader.com"
//-------- HISTORY----------------
// v0.1 Initial release(030412)
//--------------------------------

#property indicator_chart_window

string FileName="FXPT_MarkBar";

extern color  LineClr = Red;        
extern int  MarkBar   = 75;        
extern int  MaxBars   =  100;        

double Poin;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init(){

//---- indicators
if (Point == 0.00001) Poin = 0.0001; 
else if (Point == 0.001) Poin = 0.01; 
else Poin = Point; 
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit(){

//----
   DeleteObjects();
//----
   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void DeleteObjects(){
   int objs = ObjectsTotal();
   string name;
   for(int cnt=ObjectsTotal()-1;cnt>=0;cnt--){
      name=ObjectName(cnt);
      if (StringFind(name,FileName+"_",0)>-1) ObjectDelete(name);
      WindowRedraw();
   }
  }

//+------------------------------------------------------------------+
//| Custom start function                              |
//+------------------------------------------------------------------+
int start(){

  	static datetime prevtime = 0;
	int shift=0;
	string sObjNameBot;
	int    counted_bars=IndicatorCounted();

 if(prevtime == Time[0]) {
	return(0);
 }
	prevtime = Time[0];
for (shift = 1; shift < MaxBars; shift++) {
if(shift==MarkBar){
sObjNameBot=FileName+"_"+Time[shift];
ObjectCreate(sObjNameBot,OBJ_VLINE,0,Time[shift],0);
 ObjectSet(sObjNameBot,OBJPROP_WIDTH,1);
 ObjectSet(sObjNameBot,OBJPROP_STYLE,STYLE_SOLID);
 ObjectSet(sObjNameBot,OBJPROP_BACK,TRUE);
 ObjectSet(sObjNameBot,OBJPROP_COLOR, LineClr);

}

}
//----
   return(0);
}
