To initialize the loop you should do this: Cnt = 0; //Initializes entire array, not just 1st element.
When you click on the chart the number should change because you are selecting "that bar". Also see last paragraph about barcount. Otherwise, your loop is correct. Here's some code to verify with: x = BarIndex(); Plot(x,"x",1,styleStaircase); NumToStr(BarCount,1.0); NumToStr(LastValue(BarIndex()),1.0); Note the last two statements print in the interpretation window and they are different because of quickAFL. The first changes with your selection and the number of bars showing. The last does not change. It is the absolute number of bars in your data. This is probably the reason your results are changing in unexpected ways as you are using BarCount. -- Terry -----Original Message----- From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of klaus_korneker Sent: Wednesday, January 10, 2007 07:43 To: [email protected] Subject: [amibroker] loop counter Hello, i am trying to build a counter with a loop. i have already tried the following, but it seems that anything is wrong. The chart shows the bar number, but when i click inside the chart, the number changes. Cnt[0] = 0; for( i = 0; i < BarCount; i++ ) { Cnt[ i ] = i ; } Graph0 = Cnt; Thanks i advance ! Please note that this group is for discussion between users only. To get support from AmiBroker please send an e-mail directly to SUPPORT {at} amibroker.com For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG: http://www.amibroker.com/devlog/ For other support material please check also: http://www.amibroker.com/support.html Yahoo! Groups Links
