//+------------------------------------------------------------------+ //| Extend Box.mq5 | //| Copyright 2015, MetaQuotes Software Corp. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2015, MetaQuotes Software Corp." #property link "https://www.mql5.com" #property version "1.00" #property indicator_chart_window //+------------------------------------------------------------------+ #property indicator_chart_window int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { static datetime mBoxTime=0; if(time[0]+PERIOD_MN1*180 > mBoxTime) { for(int i = ObjectsTotal(0)-1; i >= 0; i--) if(ObjectGetInteger(0, ObjectName(0, i), OBJPROP_TYPE) == OBJ_RECTANGLE) ObjectSetInteger(0, ObjectName(0, i), OBJPROP_TIME, 2, time[0]+PERIOD_MN1*180); mBoxTime = time[0]+PERIOD_MN1*180; } return(rates_total); }