/*P_BarsInYear*/ InYearFlag = IIf(DateNum() >= 1060101 AND DateNum() <= 1061231,1,0); InYear = Cum(InYearFlag); Plot(InYear,"BarsInYear",colorBlack,styleLine); // Logic. // line 3 returns one if a bar is within the calender range, or zero if not, and assigns it to the InYearFlag variable; // line 4 cumulates the ones from line 3 and assigns the result to InYear; // line 5 plots the cumulated result in a chart;