#Bars Column in Analysis

Hi everyone.

I am new to AB and had a question regarding the analysis window after doing a backtest.
At the moment I am really only dabbling with the program to better understand its basic operations and not doing anything serious or complicated.

The backtesting settings I have are set to a weekly periodicity and I coded a very simple entry/exit system to get a basic understanding of things. I ran this over a 10 year period of the ASX300 watchlist using the filter.

I was looking over the results just to confirm that I had achieved what I intended and noticed the "#bars" column. I assumed that this column counted the number of bars between entry and exit based on the periodicity of the backtest e.g. 4 bars equals 4 weeks.

On one trade (16-05-14 to 12-02-16) I noticed that the bar count did not appear to match the length of the time between the entry and exit. It said "124". I opened the issue’s chart and manually confirmed that it was not 124 weeks between entry and exit. I switched from the filter to the current symbol setting and ran the backtest again. This time the bar count was correct at "92".

Is someone able to explain what is happening here? I have checked through a few of the topics already and I do not seem to be finding an answer.

Read link below and see if helps...
https://www.amibroker.com/kb/2015/01/28/why-analysis-results-and-chart-output-may-differ/

Thanks Wilson, much appreciate the reply. I had actually already checked that article and checked off all of those particular problems so in summary, no use of param, no use of pad and align data to reference symbol and no use of the Cum() function was used in the code. The code I used is as follows:

MATRIG = MA(C,30);
C1 = C> MATRIG;
C2 = C< MATRIG;
Buy = C1;
Sell = C2;

This was being used with a weekly periodicity and weekly charts. However the chart is not the source of the distortion. I only checked the chart after noticed the output in analysis was off. Thanks again for the suggestions.