English

## Simple question about closing Price!

 26 Messi86 2015.07.27 17:56   Hi all,i only want a line of close price H1 in timeframe M5. I am using this code but.... i dont understand where i am failing:```int start()   {    int counted_bars=IndicatorCounted();    if(counted_bars>0)       counted_bars--;    int limit=Bars-counted_bars;    for(int i=limit;i>=0;i--)      {        int shift=iBarShift(NULL,PERIOD_H1,iTime(NULL,Period(),i));             h1Value[i]=iClose(NULL,PERIOD_H1,shift);       }   return(0); }   ``` Thank you very much
 12983 WHRoeder 2015.07.27 19:38 #   No need for the decrement Contradictory information on IndicatorCounted() - MQL4 forum```int counted = IndicatorCounted(); int lookback = ... // iMA(period) has look back of period.                    // buffer[i+2] has look back of 2                    // use maximum of all. for(int iBar = Bars - 1 - MathMax(lookback, counted); iBar >= 0; --iBar) ... ````iTime(NULL,Period(),i)`This is identical to Time[i] Since the close[0] changes per tick, you must change the above to repaint all M5 bars that are part of the H1[0]```datetime Time0H1 = Time[0] - Time[0] % 3600;  // Start of the H1 bar zero int iH1_0 = iBarShift(NULL, 0, Time0H1);      // Bar starting H1 int iLast = Bars - 1 - MathMax(lookback, counted); for(int iBar = MathMax(iH1_0, iLast); iBar >= 0; --iBar) ...```
 26 Messi86 2015.07.27 20:54 #   ```int counted=IndicatorCounted();       int lookback=200;       datetime Time0H1 = Time[0] - Time[0] % 3600;  // Start of the H1 bar zero    int iH1_0 = iBarShift(NULL, 0, Time0H1);      // Bar starting H1    int iLast = Bars - 1 - MathMax(lookback, counted);    for(int iBar = MathMax(iH1_0, iLast); iBar >= 0; --iBar)    {       h1Value[iBar]=iClose(NULL,PERIOD_H1,iH1_0);         }          return(0); }```I prove this code. Still i have some errors...