Hello Mike, Many Thanks for the code. It works perfectly !!! I never considered using BarIndex() to solve this, so thanks for highlighting it for me....
Cheers mate.... --- In [email protected], "Mike" <sfclimb...@...> wrote: > > Here is a zero based example (i.e. does not include current bar in the > total). Add one to the result if you want to count the current bar. > > Months = Month(); > ChangeOfMonth = (Months != Ref(Months, -1)); > Indices = BarIndex(); > > Bars = Indices - ValueWhen(ChangeOfMonth, Indices, 2); > > Plot(Bars, "Bars", colorBlue, styleStaircase); > _N(Title = StrFormat("{{DATE}} {{VALUES}}")); > > Mike > > --- In [email protected], "chorlton_c_hardy" <chorlton-c-hardy@> > wrote: > > > > > > > > Hello All, > > > > > > I'm working in the Weekly timeframe and would like to calculate how many > > weekly bars have past since the START of the PREVIOUS MONTH. > > > > I can easily find out how many bars have occured since the Start of the > > Current Month using: > > > > BarsStartCurrentMth = BarsSince(Month()!=Ref(Month(),-1)) + 1 ; > > > > However, I'm struggling to find how many bars have occured since the Start > > of the Previous Month. What makes this difficult for me is that not all > > Months contain 4 weeks. > > > > Can anyone offer any help with this? > > > > Many Thanks in advance.... > > >
