Time interval indicators lines extends to zero at beginning and ending of the time interval

 

Hi I'm new to MQL5 and I was just testing something

and I come across a difference between mql4 and mql5.

If you use a time interval for showing a line in mql5 indicator,

you will see that at the beginning and the end of that line it falls down to zero

but that's not the case in mql4.

so how do I make my line like mql4 in mql5? Am I missing something?

here's the codes and picture

double         Line1Buffer[];

int OnInit()
  {
   indicator buffers mapping
   SetIndexBuffer(0,Line1Buffer,INDICATOR_DATA);
   PlotIndexSetInteger(0,PLOT_SHOW_DATA)

   return(INIT_SUCCEEDED);
  }

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[])
  {
   MqlDateTime time2;
   
   for(int i = 0 ; i < rates_total;i++){
      TimeToStruct(time[i],time2);
      if(time2.hour>6 && time2.hour<11){
         Line1Buffer[i] = high[i];
      }
   }
   return(rates_total);
  }

Files:
mql4444.png  6 kb
mql555.png  11 kb
 
Nima J:

Hi I'm new to MQL5 and I was just testing something

and I come across a difference between mql4 and mql5.

If you use a time interval for showing a line in mql5 indicator,

you will see that at the beginning and the end of that line it falls down to zero

but that's not the case in mql4.

so how do I make my line like mql4 in mql5? Am I missing something?

here's the codes and picture


if(time2.hour>6 && time2.hour<11) {
   Line1Buffer[i] = high[i];
} else
  Line1Buffer[i] = EMPTY_VALUE;

Should work on both.

 
Alexandre Borela #:

Should work on both.

It works thanks a lot :)