// Downloaded From https://www.WiseStockTrader.com _SECTION_BEGIN("Live Bar Counting on Chart"); /* This is a active chart for counting BARs. You will get number of bars instantly between two bars (Range of selected Bars). Simply select and double click on a Bar and then select another Bar and double click on it too. You will get two beatiful verticle lines. The bar counting of selected range will be displayed at the left top. This afl will help to know the number of bars in a (selected) range for a “up”, “down” or “sideways” trend or in other app;ications. To remove verticle lines double click on them. */ SetBarsRequired(100000,0); GraphXSpace = 15; SetChartOptions(0,chartShowArrows|chartShowDates); Title = EncodeColor(colorCustom11)+" live Bar Counting on Chart - compiled by CNBondre" + "---" + Name()+ "--" + EncodeColor(colorYellow)+ Interval(2) + EncodeColor(colorWhite) + " - " + Date() +" - " + EncodeColor(colorRose) +"\nOp-"+O+" "+"\nHi-"+H+" "+"\nLo-"+L+" "+ "\nCl-"+C+" "+ "\nVol = "+ WriteVal(V)+"\n" + EncodeColor(colorYellow); // Background color SetChartBkColor(ColorRGB(23,23,23)); // Display line chart for tick data automatically priceStyle = IIf( (Interval(0) == -900), styleLine, styleBar); // Quick counting of bars by range selector if (BeginValue(BarIndex()) != 0 AND EndValue(BarIndex()) != BarCount-1) { range = EndValue(BarIndex())-BeginValue(BarIndex()); Title += StrFormat("\nRange Bars No.: %g", range); } CandleBorder = ParamColor("Candle Border Color", colorBlack ); UpCandleColor = ParamColor("Up Candle Color", colorGreen ); DownCandleColor = ParamColor("Down Candle Color", colorRed ); // set amibroker to display colored bars Graph0BarColor = IIf( C > O,UpCandleColor ,DownCandleColor); Plot( C, "Close", CandleBorder, styleNoTitle | ParamStyle("Style") | priceStyle ); _SECTION_END();