i dont understand when i have to use iBarshift.
Anyone can explain me and of this way maybe i understand where i am failing in the code above.
Thank you very much!!
- 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) ...
Thank you very much WHRoeder,
i am going to study your message and prove. I think i understand but like always i use the same structure, it can that i coded wrong
Thank you very much for your reply
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...

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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:
Thank you very much