MQL5 indicator, making a horizontal line between 6 to 10 am period with value of 30 min timeframe period High Value

 
I want to make an indicator for meta trader 5 All I want to do is to draw a horizontal line between 6 to 10 AM candles. the value of the line equals to the High value of the 30 min period candle stick of each day at 6 AM. I wrote this code but it is not working

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 candelTime, period30time;
  double high30;
  for(int i = prev_calculated;i<rates_total;i++){
     TimeToStruct(time[i], candelTime);
     TimeToStruct(iTime(Symbol(),PERIOD_M30,i),period30time);
     if(candelTime.day_of_week == period30time.day_of_week && period30time.hour == 6){
        high30 = iHigh(Symbol(),PERIOD_M30,i);
     }
     if(candelTime.hour > 6 && candelTime.hour < 10){
        Line1Buffer[i] = high30;
     }
     
  }
  
return(rates_total); }


 
  1. Your loop is non-series, but do not set your array any direction.

  2. Your loop is non-series, but do not set your buffer that way.

  3. Your loop is non-series, but iTime and iHigh expects as-series index.

  4. You are mixing apples and oranges. i is the chart index but passed to the M30 chart.

  5. You want the line to be the high at 6AM, yet you get the high at 6:29:59

 
William Roeder #:
  1. Your loop is non-series, but do not set your array any direction.

  2. Your loop is non-series, but do not set your buffer that way.

  3. Your loop is non-series, but iTime and iHigh expects as-series index.

  4. You are mixing apples and oranges. i is the chart index but passed to the M30 chart.

  5. You want the line to be the high at 6AM, yet you get the high at 6:29:59

Thank you
 
Nima J :
I want to make an indicator for meta trader 5 All I want to do is to draw a horizontal line between 6 to 10 AM candles. the value of the line equals to the High value of the 30 min period candle stick of each day at 6 AM. I wrote this code but it is not working

Indicator code: Time interval

Time interval

 
Nima J #:
Thank you

You understood it? 

 
Thank-god Avwerosuoghene Odukudu #:

You understood it?

Well I am now aware of my problems but I'm not done building my own indicator
I'm in the process of learning MQL5

 
Vladimir Karputov #:

Indicator code: Time interval


WOW thanks a lot that's what I'm looking for. awesome