iBarShift() will match bar time values.
Here indexes matching bar time.
example:
for(x=0; x<limit; x++)
{
s2[x] = iStdDev(NULL, TimeFrame2, ma_period, ma_shift, ma_method, applied_price, iBarShift(NULL, TimeFrame2, Time[x], false));
}
iBarShift - Timeseries and Indicators Access - MQL4 Reference
- docs.mql4.com
iBarShift - Timeseries and Indicators Access - MQL4 Reference
What I came to understand with regards to the above is, for the buffer to have the same value, it has to be stored for the entire region
time1 = iTime(_Symbol, PERIOD_D1, 0); // Time 1 (Start) time2 = iTime(_Symbol, PERIOD_D1, 1); // Time 2 (End) //--- For the above region to have the same value in the buffer, get the bars corresponding with the using //iBarShift(), then loop through it to store through the bars, stores the values int start, end; start = iBarShift(_Symbol, 0, time1); end = iBarShift(_Symbol, 0, time2); while(start < end) { buffer[start] = value to be stored; start++; } //--- If you noticed, I used "0" and not a particular period, because we want the region in whatever timeframe we are looking at.
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
How do I get a region, lets say daily TF to display the same value for my index buffer, without having to use time[] array. I used iTime() to get the values of the various time to calculate for, but the index buffer is having different values for each candle and not the time frame regions.
Thanks