Number of bars changes in the debugger


#1

I have two charts (chart1 and chart2) with scripts script1 and script2 respectively. (Actually it is the same script copied into two different files).
I set 1minute period at Chart1 (about 12.000 bars) and 1Hour period at chart2 (close to 200 bars). Same symbol (only one symbol in the database).
I edit both scripts and I go in both scripts into debug mode. I want to examine the contents of their arrays (ex High).

What I noticed is this:
If I click on chart1, go to edit mode, then go to script2, the array has the size of chart1 (close to 12.000 bars).

If I click on chart2, go to edit mode, then go to script1, the array has the size of chart2 (close to 200 bars).

I found this a little confusing, I was expecting chart1 to always have 12.000 bars (in debug mode) and chart2 to always have 200 bars (in debug mode).

I have Amibroker v 6.28.0 64 bit in windows7 64bit.


#2

Simply, never make any assumptions on number of bars.
Number of bars can be from zero1 to plus infinity2.
http://www.amibroker.com/kb/2014/09/22/do-not-make-assumptions-on-number-of-bars/

1 in practice your formula won't be run at all if symbol has no data (number of bars is zero), so for all practical uses BarCount >= 1

2 again in practice you are limited by RAM size and 32-bit arithmetic which means that single array can't be larger than 4GB (1 billion elements).


#3

Even if I use this?

SetBarsRequired( -2, -2 );

Anyway, I can present the situation in a different way.

in = Interval();

In the debuger it should have value 3600 (since we are in 1Hour TimeFrame). It is reported to be 60. This happened because I went to script2 by going into edit mode from chart1 -> script1 -> script2.

ab


#4

I'd like to clarify in the above image (previous post), the 1min chart on the left uses the script aaaaaa3.afl, while the 1Hour chart on the right uses the aaaaaa4.afl.

Therefore the in=60 in the debugger watch is puzling me. It should be in=3600, right?

++++++++++++++++++++

To make more clear the point from the first post, please take a look at this video:

If you go directly to aa1.afl script, the last barindex() = 11489. If you first edit the aa2.afl, then go to aa1.afl, then the last barindex()=2308, which is the same like the aa2.afl.

However in this case I do understand that "never make any assumptions on number of bars".


#5

Is the English language a difficult language?
Let's see...

1358

Current chart interval means currently selected chart's interval!
The setting does not say "Now use current chart interval of chart where Bob's superpower AFL is applied on".

So of course it shows 60 for all AFLs applied in editor if 1 minute interval is selected one of the selected chart as in your picture and it shows 3600 for all ones if hourly interval is selected one of selected chart (if upper preferences' setting is applied). :roll_eyes:

c449ca8b3c2ff1f2bededdbc36dbca0d20c7f8a3

BTW, just so you know.... one single very same AFL (for simplicity let's call that AFL "aaaaaaALL4oneAND1forALL.afl" so that it will not get too much complicated (as it stands for all AFLs ever made)) can be applied to multiple charts (via "insert linked") at the same time and those charts can have multiple different intervals in addition (and at the same time). Oops, which one to choose from...? I can already see someone's brain power plant at heavy work for many days from now. Let's hope it will not end up in ultimate MCA.

"It's a very niiiice!"
50


#6

Thank you fxshrat. This was exactly the misinterpretation I had done.