//+------------------------------------------------------------------+ //| barComplete.mq4 | //| Copyright © 2009, Jason Muchow (airforcemook@hotmail.com) | //| | //+------------------------------------------------------------------+ extern bool text = true; extern int width = 3; #property indicator_chart_window //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { //---- ObjectDelete("barComplete_bg"); ObjectDelete("barComplete_p"); double top = WindowPriceMax(0); double bottom = WindowPriceMin(0); double difference = TimeCurrent() - Time[0]; double total = Period()*60; double percent = difference / total; //Print("This bar is " + percent + "% complete."); double move = top - bottom; double barHeightMax = bottom + (percent * move); ObjectCreate("barComplete_bg",OBJ_RECTANGLE,0,Time[0]+5*Period()*60,top,Time[0]+(5+width)*Period()*60,top - (1-percent)*move); ObjectSet("barComplete_bg",OBJPROP_COLOR,DarkGray); ObjectCreate("barComplete_p",OBJ_RECTANGLE,0,Time[0]+5*Period()*60,bottom,Time[0]+(5+width)*Period()*60,barHeightMax); ObjectSet("barComplete_p",OBJPROP_COLOR,Red); ObjectDelete("barComplete_txt"); int p = percent*100; string pText = p+"%"; ObjectCreate("barComplete_txt",OBJ_TEXT,0,Time[0]+(5+width+3)*Period()*60,(top+bottom)/2); ObjectSetText("barComplete_txt",pText,12,"Arial",White); if (p > 100) { ObjectSetText("barComplete_txt","LATE!",12,"Arial",Red); } //---- return(0); } //+------------------------------------------------------------------+
Sample
Analysis
Market Information Used:
Series array that contains open time of each bar
Indicator Curves created:
Indicators Used:
Custom Indicators Used:
Order Management characteristics:
Other Features: