Indicators: iForexSessions - page 9

 
Great forex sessions indicator. Very helpful for day trading.
 
Excellent indicator. Conveniently shows sessions + cool function with Ctrl to get session parameters at a specific point in time.
 
//+------------------------------------------------------------------+
//| Create vertical lines and colored rectangles for forex sessions  |
//+------------------------------------------------------------------+
void DrawSessions(SBrokerSession &BrokerSessions[][4])
  {
   string obj_name, tooltip;
   datetime time1, time2;
   double price1, price2;
   color sColor;
   double high[];
   double dayhigh;
   bool weekstart;
//---
   string session_names[]= {"Sydney","Tokyo","London","NewYork"};
   string session_labels[]= {"SYD","TOK","LON","NYC"};
   color session_colors[4];
   session_colors[0]=InpColorSydney;
   session_colors[1]=InpColorTokyo;
   session_colors[2]=InpColorLondon;
   session_colors[3]=InpColorNewYork;
//--- find the highest and lowest values of the chart
   double max_price=ChartGetDouble(0,CHART_PRICE_MAX);
   double min_price=ChartGetDouble(0,CHART_PRICE_MIN);
   double height=(max_price-min_price)/70;
//--- delete objects
   ObjectsDeleteAll(0,obj_name_prefix);
//---
   for(int i = 0; i < ArrayRange(BrokerSessions, 0); i++)
     {
      if(InpShowVLines)
        {
         //--- Show sydney-session start lines
         time1     = BrokerSessions[i][SYD].BeginBroker;
         obj_name  = obj_name_prefix+":  "+CTimeZoneInfo::FormatTimeForPlace(time1, ZONE_ID_BROKER, false, false);
         weekstart = (i+1 < ArrayRange(BrokerSessions, 0)) && (time1 - BrokerSessions[i+1][SYD].BeginBroker > 24*3600);
         sColor    = weekstart ? clrDarkOrange : clrWheat;
         VLineCreate(obj_name,time1,sColor,STYLE_DASHDOTDOT);
         //--- Show day of week text label
         int shift = iBarShift(Symbol(),0,time1);
         double low = iLow(Symbol(),0,shift);
         string wkday = EnumToString((ENUM_DAY_OF_WEEK)(((uint)time1 / 86400 + 4) % 7));                  
         TextCreate(obj_name+"_wkday",wkday,time1,low-50*_Point,sColor);                               
        }
      int copied=CopyHigh(Symbol(),PERIOD_H1,BrokerSessions[i][SYD].BeginBroker,BrokerSessions[i][NYC].EndBroker,high);
      if(copied<=0)
         continue;
      dayhigh=high[ArrayMaximum(high)];
      for(int s = 0; s < ArraySize(session_names); s++)
        {
         obj_name = obj_name_prefix+session_names[s]+"Rect"+(string)i;
         time1    = BrokerSessions[i][s].BeginBroker;
         time2    = BrokerSessions[i][s].EndBroker;
         price1   = dayhigh + (height*1.3)*(4-s);
         price2   = price1 - height;
         sColor   = session_colors[s];
         tooltip  = session_names[s]+" session from "+TimeToString(time1,TIME_MINUTES)+" to "+TimeToString(time2,TIME_MINUTES)+" (server time)";
         RectangleCreate(obj_name,time1,price1,time2,price2,sColor,tooltip);
         //---
         if(InpShowLabels)
           {
            obj_name = obj_name_prefix+session_names[s]+"Text"+(string)i;
            tooltip  = session_labels[s]+" "+TimeToString(time1,TIME_MINUTES);
            TextCreate(obj_name,tooltip,time1,price1-(height/2),clrWheat);
           }
        }
     }
//---
  }


How did you choose the numbers 70 and 1.3 to calculate the height of the session block in the highlighted lines above?

If user uses a non-standard resolution or text scale, the block and text will appear distorted.

 
Thanks for this applicable and wonderful indicator.
 
A great effort and result