I recently came across something a bit un-intuitive in W59 that caught me out, so I'd like to mention it here it to save the same happening to others.
Summary
The issue is that gaps in the chart (ie blank areas where you would normally see a price bar) have an impact on all the tools that rely on bar counts (ie most indicators like RSI, momentum, stochastics as well as draw tools like the bar counter).
That impact may not be noticeable, so in most cases it won't matter in practice (except maybe if you're a Virgo
![Very Happy :D](./images/smilies/icon_e_biggrin.gif)
The solution is to fill those gaps if you don't want them to impact on bar counts (and downstream calculations). For most users of daily charts this means inputting holiday dates in the chart format area and selecting the option to enable holiday filtering.
More details
Why may this be unintuitive? Firstly, consider there are two time-frames for looking at a daily chart ie calendar days and trading days. If you select the trading days option, then the natural expectation is that you won't be dealing with bars on a day where there is no trading. Similarly, if you are counting bars (either indirectly via indicators or qscripts or directly via draw tools like the bar counter) then you don't expect non-trade bars to be included. This is especially the case with the bar count tool where it has an option to count "Trading Days (Bars on the chart)". If you selected that option, you would not expect the bar count to include non-trade days.
Why can gaps appear? A gap will appear at anytime where the program expects to receive data but doesn't actually have any data. The main example is public holidays. So if your chart is set for trading days, the program will know that weekends are to be ignored, however any weekday where there is no trading data will still be shown as a gap. Behind the scenes, in doing the calculations of counts and indicators etc, it will treat that gap as if it were a price bar having the same data as the preceding bar.
Why is it so? The reason is to allow W59 to accommodate markets which are so thin that bars can exist where there are no trades.
Other options? For users that work with qscript, there will be a new "bar_has_data" keyword in v2.27 that will help identify these bars. In the meantime, you can get your script to look at data like volume to distinguish a trade day from a non trade day. If there is no volume data you can also compare OHLC from one bar to the next (ie if identical then likely it is not a trade bar). If you have very old data (ie just close) and/or you have many years of data with multiple holiday dates, you may want to make use of the holiday.txt file in the W59 working directory (ensure you get the format right - enter a date manually first via the chart format options area and use that same format for any dates you enter into the file).
If anyone has any queries on this, please post them here so I can save Earik having to repeat anything he has already very patiently explained to me!