//+------------------------------------------------------------------+ //| PriceInfo.mq4 | //| Copyright © 2011, LHFC | //| http://www.lhfc.it | //+------------------------------------------------------------------+ #property indicator_chart_window extern string tf_s="Timeframe. W1=10080, D1=1440, H1=60"; extern int tf=PERIOD_D1; extern int font_size=35; extern int x_position = 2; extern int y_position = 200; extern color price_up_color = SpringGreen; extern color price_down_color = Tomato; extern color price_base_color = White; double last_price; string now_price_s="now_price"; string close_price_s="close_price"; string low_price_s="low_price"; string high_price_s="high_price"; int init() { Print("PriceInfo Indicator by LHFC, www.lhfc.it"); return(0); } int deinit() { ObjectDelete(now_price_s); ObjectDelete(close_price_s); ObjectDelete(high_price_s); ObjectDelete(low_price_s); return(0); } int adjustPrecision(){ int prec=MarketInfo(Symbol(),MODE_DIGITS); if(prec == 3 || prec == 5) prec = prec-1; return (prec); } int start() { int precision=adjustPrecision(); double now_price=Bid; double low_price=iLow(Symbol(),tf,0); double high_price=iHigh(Symbol(),tf,0); double close_price=iClose(Symbol(),tf,1); //now price ObjectCreate(now_price_s, OBJ_LABEL, 0, 0, 0); if (Bid > last_price) ObjectSetText(now_price_s, DoubleToStr(now_price,precision), font_size, "Arial", price_up_color); if (Bid < last_price) ObjectSetText(now_price_s, DoubleToStr(now_price,precision), font_size, "Arial", price_down_color); last_price = Bid; ObjectSet(now_price_s, OBJPROP_XDISTANCE, x_position); ObjectSet(now_price_s, OBJPROP_YDISTANCE, y_position); //close price ObjectCreate(close_price_s, OBJ_LABEL, 0, 0, 0); if (now_price > close_price) ObjectSetText(close_price_s, DoubleToStr(close_price,precision)+" "+DoubleToStr(((now_price-close_price)*100/close_price),2)+"%", font_size-20, "Arial", price_up_color); if (now_price < close_price) ObjectSetText(close_price_s, DoubleToStr(close_price,precision)+" "+DoubleToStr(((now_price-close_price)*100/close_price),2)+"%", font_size-20, "Arial", price_down_color); ObjectSet(close_price_s, OBJPROP_XDISTANCE, x_position); ObjectSet(close_price_s, OBJPROP_YDISTANCE, y_position+50); //high price ObjectCreate(high_price_s, OBJ_LABEL, 0, 0, 0); ObjectSetText(high_price_s, DoubleToStr(high_price,precision)+" "+DoubleToStr(((high_price-close_price)*100/close_price),2)+"%", font_size-20, "Arial", price_base_color); ObjectSet(high_price_s, OBJPROP_XDISTANCE, x_position); ObjectSet(high_price_s, OBJPROP_YDISTANCE, y_position+70); //low price ObjectCreate(low_price_s, OBJ_LABEL, 0, 0, 0); ObjectSetText(low_price_s, DoubleToStr(low_price,precision)+" "+DoubleToStr(((low_price-close_price)*100/close_price),2)+"%", font_size-20, "Arial", price_base_color); ObjectSet(low_price_s, OBJPROP_XDISTANCE, x_position); ObjectSet(low_price_s, OBJPROP_YDISTANCE, y_position+90); }