Why don't you just use iBarShift to find the bar that relates to the time you want, then retrieve the value using iHigh / iLow / iClose / iOpen?
OK to answer the title, the best way appears to be what I put in my OP.
Why not just look at the Weekly bars instead? The bar's iTime() of the weekly bar, is thus the beginning of the week, and with the aid of the iBarShift(), you can find the first M5 bar for the week
Also, the OHLC values from the Weekly bars already gives you what you need to calculate the pivot points. No need to go through all those M5 bars to do it!
I'm still missing what you're after I'm afraid. I don't understand what the relevance of the M5 chart is?
If you want the high, low and close of last week why don't you use:
double LastWkHigh =iHigh(NULL,PERIOD_W1,1), LastWkLow =iLow(NULL,PERIOD_W1,1), LastWkClose=iClose(NULL,PERIOD_W1,1);

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello
I'm working on a bespoke missed weekly pivots calculation. If the user pulls such onto an M5 chart, as I process the Bars, if the Time of the last bar (i+1) is Sunday and the time of 'this' bar is Monday, I know i+1 is the last of last week.
What I was thinking of doing was then counting back to the first bar of 0000-0005 of the previous Monday and calc my pivot for last week from there. I was wondering what the best way to calc this would be. My thought:
7200 / Period()
or is there a build-in I can use that I havent find yet?
Thanks