Hello
I am trying to access/extract a subscript [i] if an array element a[i].
The aim is to input a date and extract the bar subscript from that date's bar
so that the subscript can be used over-write/modify an associated array
element[i] (if I understand how array data is constructed in AFL correctly ???)
A test code segment and debug outputis shown below. The issue I am having
difficulty with is that in the first line the index and barcount are correct if
all the data (including bars not displayed on the screen) is taken into
account. In line 2 the barcount readjusts to number of bars displayed on the
screen. I can accept that as a quirk but works. I then zoom out (as shown by
barcount)loading all the bars (data) onto the screen(debug shows zoomout effect
in line 9 - 26. But the subscript [i] is now empty from line 20 - as I continue
to zoom out on the chart. Why?
Is this a bug or is there something I am missing??
Can anyone offer an explanation as to what is happening?
// Array or number ?
dt = ParamDate("Date of the trend", "2009-05-25" ,0);
i=0;
i = ValueWhen(DateNum() == dt, BarIndex(), 1);
_TRACE(" i = " + NumToStr(i, 1.0) + " index date = " + NumToStr(dt, 1.0) + "
Barcount = " + NumToStr(BarCount, 1.0) );
00000000 0.00000000 [2440] i = 6,413 index date = 1,090,525
Barcount = 6,416
00000001 0.03319501 [2440] i = 6,413 index date = 1,090,525
Barcount = 69
00000002 2.32265329 [2440] i = 6,413 index date = 1,090,525
Barcount = 69
00000003 7.29352045 [2440] i = 6,413 index date = 1,090,525
Barcount = 69
00000004 12.29429150 [2440] i = 6,413 index date = 1,090,525
Barcount = 69
00000005 17.29241562 [2440] i = 6,413 index date = 1,090,525
Barcount = 69
00000006 22.29343414 [2440] i = 6,413 index date = 1,090,525
Barcount = 69
00000007 27.29189682 [2440] i = 6,413 index date = 1,090,525
Barcount = 69
00000008 32.29233551 [2440] i = 6,413 index date = 1,090,525
Barcount = 69
00000009 36.40725327 [2440] i = 6,413 index date = 1,090,525
Barcount = 92
00000010 36.77444458 [2440] i = 6,413 index date = 1,090,525
Barcount = 127
00000011 37.05470276 [2440] i = 6,413 index date = 1,090,525
Barcount = 179
00000012 37.29121780 [2440] i = 6,413 index date = 1,090,525
Barcount = 179
00000013 37.30448532 [2440] i = 6,413 index date = 1,090,525
Barcount = 257
00000014 37.54277802 [2440] i = 6,413 index date = 1,090,525
Barcount = 374
00000015 37.72683716 [2440] i = 6,413 index date = 1,090,525
Barcount = 550
00000016 37.91091156 [2440] i = 6,413 index date = 1,090,525
Barcount = 814
00000017 38.09486389 [2440] i = 6,413 index date = 1,090,525
Barcount = 1,210
00000018 38.33518219 [2440] i = 6,413 index date = 1,090,525
Barcount = 1,804
00000019 39.79113770 [2440] i = 6,413 index date = 1,090,525
Barcount = 2,695
00000020 40.27950287 [2440] i = {EMPTY} index date = 1,090,525
Barcount = 4,031
00000021 40.58501816 [2440] i = {EMPTY} index date = 1,090,525
Barcount = 6,035
00000022 40.80830765 [2440] i = {EMPTY} index date = 1,090,525
Barcount = 6,416
00000023 42.29502487 [2440] i = {EMPTY} index date = 1,090,525
Barcount = 6,416
00000024 47.29590988 [2440] i = {EMPTY} index date = 1,090,525
Barcount = 6,416
00000025 52.29293823 [2440] i = {EMPTY} index date = 1,090,525
Barcount = 6,416
00000026 57.29567719 [2440] i = {EMPTY} index date = 1,090,525
Barcount = 6,416