Draw Vertical Line to Future Time

 

I can draw a vertical line from past date into current date but how to draw a vertical line into future date?

Please help, there is vertical line number 1 and vertical line number 2

  The distance between two lines with the number of candles = 20 candles

I want to draw a vertical line No. 3 in the future, starting from line No. 1 with 20 candles, not counting holidays



Documentation on MQL5: Constants, Enumerations and Structures / Objects Constants / Object Types
Documentation on MQL5: Constants, Enumerations and Structures / Objects Constants / Object Types
  • www.mql5.com
Object Types - Objects Constants - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
عمرو الشرقاوى:

I can draw a vertical line from past date into current date but how to draw a vertical line into future date?

Please help, there is vertical line number 1 and vertical line number 2

  The distance between two lines with the number of candles = 20 candles

I want to draw a vertical line No. 3 in the future, starting from line No. 1 with 20 candles, not counting holidays

#property indicator_chart_window
#property indicator_plots 0

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
{
//---
  return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
  ObjectsDeleteAll(0,"TL");
  ChartRedraw();
}
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
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[])
{
  if(rates_total-prev_calculated==0)
    return(rates_total);
  ArraySetAsSeries(time,true);
  ArraySetAsSeries(open,true);

  SetTLine(0, "TL", time[0], open[0], time[0]+PeriodSeconds()*20, open[0], clrAqua);

  return(rates_total);
}
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void SetTLine(long chart_ID,string nm,datetime t1,double p1,datetime t2,double p2,color cl)
{
  if(ObjectFind(chart_ID,nm)<0) {
    ObjectCreate(chart_ID,nm,OBJ_TREND,0,0,0,0);
    ObjectSetInteger(chart_ID,nm,OBJPROP_RAY,false);
    ObjectSetInteger(chart_ID,nm,OBJPROP_STYLE,0);
    ObjectSetInteger(chart_ID,nm,OBJPROP_WIDTH,2);
    ObjectSetInteger(chart_ID,nm,OBJPROP_SELECTABLE,true);
    ObjectSetInteger(chart_ID,nm,OBJPROP_SELECTED,false);
    ObjectSetInteger(chart_ID,nm,OBJPROP_HIDDEN,false);
    ObjectSetInteger(chart_ID,nm,OBJPROP_BACK,false);
    ObjectSetInteger(chart_ID,nm,OBJPROP_TIME,t1);
    ObjectSetDouble(chart_ID,nm,OBJPROP_PRICE,p1);
    ObjectSetInteger(chart_ID,nm,OBJPROP_TIME,1,t2);
    ObjectSetDouble(chart_ID,nm,OBJPROP_PRICE,1,p2);
    ObjectSetInteger(chart_ID,nm,OBJPROP_COLOR,cl);
  }
}
//+------------------------------------------------------------------+