[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: Array question



PureBytes Links

Trading Reference Links

Interesting.  Does this display a specific element of the array
TestArray on your computer?  Would you mind creating an array and
storing Now() to each element? Then tell me the specific value of,
say, the 803rd and 804th elements. I'd also like to see you change the
value of, say, the 755th thru 799th elements to 123.  If you can print
actual output from your script and paste it with the code that would
most useful.

Thanks.


--- In amibroker@xxxxxxxxxxxxxxx, Graham <kavemanperth@xxxx> wrote:
> yes it would be faster, if you could really see the speed because it
> has only one variable to display, i
> You do not need the line TestArray = C; at all.
> 
> In fact ifthat is all you wanted why not just use this, as you do not
> need loop at all
> 
> printf( "The Value of TestArray[" + NumToStr(barindex(),1) + "] is "
+ "38.21");
> 
> 
> On 9/4/05, sam_92841 <sam_92841@xxxx> wrote:
> > > does this help
> > It's excellent, but this is faster:
> > 
> > TestArray = C;
> > 
> > for(i = 0; i < BarCount; i++)
> >        {
> > printf( "The Value of TestArray[" + NumToStr(i,1) + "] is " +
"38.21");
> > 
> >        }
> > 
> > --- In amibroker@xxxxxxxxxxxxxxx, Graham <kavemanperth@xxxx> wrote:
> > > does this help
> > > TestArray = C;
> > >
> > > for(i = 0; i < BarCount; i++)
> > >        {
> > > printf( "The Value of TestArray[" + NumToStr(i,1) + "] is " +
> > > NumToStr(TestArray,1.3));
> > >
> > >        }
> > >
> > > you just have to tell it what you want it to do
> > >
> > > On 9/4/05, sam_92841 <sam_92841@xxxx> wrote:
> > > > neuro,
> > > >
> > > > I suspect plot() expects an array to be plotted whereas bc is
a single
> > > > value.
> > > >
> > > > Terry,
> > > >
> > > > Initializing the array with C sounded like a good idea but it
does not
> > > > work.  Try this:
> > > >
> > > > TestArray = C;
> > > >
> > > > for(i = 0; i < BarCount; i++)
> > > >        {
> > > >
> > > >   "The Value of TestArray[" + NumToStr(i) + "] is " +
> > > > NumToStr(TestArray[i]);
> > > >        }
> > > >
> > > > This code prints not a single thing on my computer.
> > > >
> > > >
> > > > --- In amibroker@xxxxxxxxxxxxxxx, "Terry" <MagicTH@xxxx> wrote:
> > > > > Right. I didn't explain correctly. C[BarCount - 2] will give you
> > > > > yesterday's close. One way would be to say TestArray = C; and
> > then use
> > > > > TestArray to hold whatever data you want (by looping through
it and
> > > > > changing the values from C to whatever). If one wants permanent
> > storage
> > > > > then create the dummy ticker and use it's C value (or it's
O,H,L,V).
> > > > > with Foreign to store and retrieve the new array.
> > > > > --
> > > > > Terry
> > > > >
> > > > > | -----Original Message-----
> > > > > | From: amibroker@xxxxxxxxxxxxxxx
> > [mailto:amibroker@xxxxxxxxxxxxxxx] On
> > > > > | Behalf Of neurotic self
> > > > > | Sent: Saturday, September 03, 2005 17:02
> > > > > | To: amibroker@xxxxxxxxxxxxxxx
> > > > > | Subject: Re: [amibroker] Re: Array question
> > > > > |
> > > > > | Terry:
> > > > > |
> > > > > | AFAIK even if you have a symbol named Testarray you don't
> > access its
> > > > > | values with
> > > > > | Testarray[whateverindexhere], you're implicitly declaring a
> > new array
> > > > > |
> > > > > | Sam:
> > > > > |
> > > > > | you're right, I see something similar with Apply indicator
> > > > > |
> > > > > | check with this as an indicator
> > > > > |
> > > > > | bc = BarCount;
> > > > > | Plot(bc, "Barcount", colorRed);
> > > > > |
> > > > > | see as it plots different levels after you click Apply
> > indicator and
> > > > > | when you slide the graph to see the past quotes, strange
> > behavior...
> > > > > |
> > > > > | Looks like a matter for support to me, maybe you should write
> > them, or
> > > > > | I misunderstood how BarCount works, maybe Thomasz or
someone more
> > > > > | knowledgeable will come to help...
> > > > > |
> > > > > | neuro
> > > > > |
> > > > > | On 9/4/05, Terry <MagicTH@xxxx> wrote:
> > > > > | > Yes, but this is the barcount for QQQQ.
> > > > > | > If you have no data in TestArray, there is no barcount (well
> > maybe 0
> > > > > | > works). Barcount is per ticker and depends on how much
data is
> > > > > | there.
> > > > > | >
> > > > > | > Do as Graham suggested and populate a dummy ticker or
duplicate
> > > > > | another
> > > > > | > one, like QQQQ, and rename to TestArray. You can zero out
> > the values
> > > > > | or
> > > > > | > replace them with a loop.
> > > > > | > --
> > > > > | > Terry
> > > > > | >
> > > > > | > | -----Original Message-----
> > > > > | > | From: amibroker@xxxxxxxxxxxxxxx
> > [mailto:amibroker@xxxxxxxxxxxxxxx]
> > > > > | On
> > > > > | > | Behalf Of sam_92841
> > > > > | > | Sent: Saturday, September 03, 2005 14:58
> > > > > | > | To: amibroker@xxxxxxxxxxxxxxx
> > > > > | > | Subject: [amibroker] Re: Array question
> > > > > | > |
> > > > > | > | 1.) Show the chart of QQQQ (data from March 2000 to
present)
> > > > > | > | 2.) Click analysis, commentary.  Click load and open the
> > script
> > > > > | > | containing only the two lines shown below.
> > > > > | > | 3.) Click apply, then commentary tab.  Says "barcount is
> > > > > | 1,634.000"
> > > > > | > | 4.) Close Commentary
> > > > > | > | 5.) Click analysis, formula editor, open same script
opened in
> > > > > | > | Commentary.  Click apply indicator.  Get the
"Subscript out of
> > > > > | > | range..." error.
> > > > > | > |
> > > > > | > |
> > > > > | > |
> > > > > | > | --- In amibroker@xxxxxxxxxxxxxxx, neurotic self
> > > > > | <neuroticself@xxxx>
> > > > > | > | wrote:
> > > > > | > | > Uh? it works for me as expected in a commentary
window on a
> > > > > | single
> > > > > | > | > symbol, just fails if I put a number >= BarCount
> > > > > | > | >
> > > > > | > | > Where/how do you run the last script?
> > > > > | > | >
> > > > > | > | > On 9/3/05, sam_92841 <sam_92841@xxxx> wrote:
> > > > > | > | > > Thanks neuro.  I think I understand what Graham said
> > however I
> > > > > | am
> > > > > | > | > > still having problems.  The following script indicates
> > there
> > > > > | are
> > > > > | > | 1684
> > > > > | > | > > bars for QQQQ but the script still fails with the same
> > error.
> > > > > | > | > >
> > > > > | > | > > "barcount is " + NumToStr(BarCount);
> > > > > | > | > > TestArray[800] = 0;  // test
> > > > > | > | > >
> > > > > | > | > >
> > > > > | > | > >
> > > > > | > | > > --- In amibroker@xxxxxxxxxxxxxxx, neurotic self
> > > > > | > | <neuroticself@xxxx> wrote:
> > > > > | > | > > > Hi Sam,
> > > > > | > | > > >
> > > > > | > | > > > just a clarification, ignore if useless to you.
> > > > > | > | > > >
> > > > > | > | > > > TickerScore[800] = 0;
> > > > > | > | > > >
> > > > > | > | > > > AFAIK this is NOT declaring an 800 items array, just
> > trying
> > > > > | to
> > > > > | > | assign
> > > > > | > | > > > zero to the 800th element. All arrays are implicitly
> > > > > | declared
> > > > > | > | with
> > > > > | > | > > > BarCount elements, that's why Graham suggested
> > creating a
> > > > > | fake
> > > > > | > | symbol
> > > > > | > | > > > with more history.
> > > > > | > | > > >
> > > > > | > | > > > neuro
> > > > > | > | > > >
> > > > > | > | > > > On 9/3/05, Graham <kavemanperth@xxxx> wrote:
> > > > > | > | > > > > for starters there are only 64 watchlists,
0.....63
> > > > > | > | > > > > Param( "Watchlist", 5, 0, 63, 0 );//
> > > > > | > | > > > >
> > > > > | > | > > > >
> > > > > | > | > > > > to create a larger ticker length, just create a
> > new ticker
> > > > > | > | then using
> > > > > | > | > > > > excel create a long history for it in a csv
file and
> > > > > | import
> > > > > | > | this to
> > > > > | > | > > > > AB.
> > > > > | > | > > > >
> > > > > | > | > > > >
> > > > > | > | > > > > I just loaded into AB and not really cerain
what it is
> > > > > | meant
> > > > > | > | to do but
> > > > > | > | > > > > i got no error messages
> > > > > | > | > > > >
> > > > > | > | > > > > On 9/3/05, sam_92841 <sam_92841@xxxx> wrote:
> > > > > | > | > > > > > I modified the following script as a test to
try to
> > > > > | declare
> > > > > | > | an array
> > > > > | > | > > > > > with 800 elements.  The error message is:
> > > > > | > | > > > > > Error 10
> > > > > | > | > > > > > Subscript out of range.
> > > > > | > | > > > > > You must not access array elements outside
> > 0..(BarCount-
> > > > > | 1)
> > > > > | > | range.
> > > > > | > | > > > > >
> > > > > | > | > > > > > If there is a way to make a larger array please
> > point me
> > > > > | to
> > > > > | > | the
> > > > > | > | > > > > > section in the help file.
> > > > > | > | > > > > >
> > > > > | > | > > > > > Regards,
> > > > > | > | > > > > >
> > > > > | > | > > > > > Sam
> > > > > | > | > > > > >
> > > > > | > | > > > > > Listnum = Param( "Watchlist", 5, 0, 100, 0 );//
> > > > > | Watchlist to
> > > > > | > | > > display.
> > > > > | > | > > > > >
> > > > > | > | > > > > > // the start point of comparision will be
> > StartPoint bar
> > > > > | > | > > > > > sp = Param( "Startpoint %", 55, 1, 100, 1 );
> > > > > | > | > > > > > startpoint = int(BarCount*(sp/100));
> > > > > | > | > > > > >
> > > > > | > | > > > > > // Here is a base line - We Use Currenty
Selected
> > > > > | Ticker.
> > > > > | > | > > > > > // (Use an Index as your Base eg XAO,XEJ,XMJ
Etc...)
> > > > > | > | > > > > > price = Close;
> > > > > | > | > > > > > baseline = 100 * ( price/ValueWhen( Cum(1) ==
> > > > > | startpoint,
> > > > > | > | price
> > > > > | > | > > ) - 1 );
> > > > > | > | > > > > >
> > > > > | > | > > > > > // base line chart (flat line)
> > > > > | > | > > > > > Plot ( baseline - baseline,Name(),6,1);
> > > > > | > | > > > > > TickerScore[800] = 0;  // test
> > > > > | > | > > > > >
> > > > > | > | > > > > > list = CategoryGetSymbols( categoryWatchlist,
> > listnum );
> > > > > | > | > > > > > for( i = 0; ( sym = StrExtract( list, i ) ) !=
> > ""; i++ )
> > > > > | > | > > > > >  {
> > > > > | > | > > > > >
> > > > > | > | > > > > >
> > > > > | > | > > > > >    price = Foreign( sym, "C" );
> > > > > | > | > > > > >
> > > > > | > | > > > > >         Plot (100 * ( price/ValueWhen( Cum(1) ==
> > > > > | startpoint,
> > > > > | > | > > price ) - 1 )-
> > > > > | > | > > > > > baseline,sym,6+i,1);
> > > > > | > | > > > > >  }
> > > > > | > | > > > > >
> > > > > | > | > > > > >
> > > > > | > | > > > > > --- In amibroker@xxxxxxxxxxxxxxx, Graham
> > > > > | <kavemanperth@xxxx>
> > > > > | > | wrote:
> > > > > | > | > > > > > > create a new larger array ticker to the size
> > you want
> > > > > | > | > > > > > >
> > > > > | > | > > > > > > On 9/1/05, sam_92841 <sam_92841@xxxx> wrote:
> > > > > | > | > > > > > > >
> > http://www.amibroker.com/library/formula.php?id=434
> > > > > | > | > > > > > > >
> > > > > | > | > > > > > > > I found this script which attempts to rank
> > stocks,
> > > > > | > | however
> > > > > | > | > > it fails if
> > > > > | > | > > > > > > > the number of tickers in the watchlist is
> > greater
> > > > > | than
> > > > > | > | BarCount.
> > > > > | > | > > > > > > >
> > > > > | > | > > > > > > > Is it possible to create an array with more
> > elements
> > > > > | > | than
> > > > > | > | > > barcount?  I
> > > > > | > | > > > > > > > cannot find a way to do that.
> > > > > | > | > > > > > > >
> > > > > | > | > > > > > > > Regards,
> > > > > | > | > > > > > > >
> > > > > | > | > > > > > > > Sam
> > > > > | > | > > > > > > >
> > > > > | > | > > > > > > >
> > > > > | > | > > > > > > >
> > > > > | > | > > > > > > >
> > > > > | > | > > > > > > >
> > > > > | > | > > > > > > >
> > > > > | > | > > > > > > >
> > > > > | > | > > > > > > > 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 other support material please check
also:
> > > > > | > | > > > > > > > http://www.amibroker.com/support.html
> > > > > | > | > > > > > > >
> > > > > | > | > > > > > > >
> > > > > | > | > > > > > > > Yahoo! Groups Links
> > > > > | > | > > > > > > >
> > > > > | > | > > > > > > >
> > > > > | > | > > > > > > >
> > > > > | > | > > > > > > >
> > > > > | > | > > > > > > >
> > > > > | > | > > > > > > >
> > > > > | > | > > > > > > >
> > > > > | > | > > > > > >
> > > > > | > | > > > > > >
> > > > > | > | > > > > > > --
> > > > > | > | > > > > > > Cheers
> > > > > | > | > > > > > > Graham
> > > > > | > | > > > > > > AB-Write >< Professional AFL Writing Service
> > > > > | > | > > > > > > Yes, I write AFL code to your requirements
> > > > > | > | > > > > > > http://e-wire.net.au/~eb_kavan/ab_write.htm
> > > > > | > | > > > > >
> > > > > | > | > > > > >
> > > > > | > | > > > > >
> > > > > | > | > > > > >
> > > > > | > | > > > > >
> > > > > | > | > > > > > 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 other support material please check also:
> > > > > | > | > > > > > http://www.amibroker.com/support.html
> > > > > | > | > > > > >
> > > > > | > | > > > > >
> > > > > | > | > > > > > Yahoo! Groups Links
> > > > > | > | > > > > >
> > > > > | > | > > > > >
> > > > > | > | > > > > >
> > > > > | > | > > > > >
> > > > > | > | > > > > >
> > > > > | > | > > > > >
> > > > > | > | > > > > >
> > > > > | > | > > > >
> > > > > | > | > > > >
> > > > > | > | > > > > --
> > > > > | > | > > > > Cheers
> > > > > | > | > > > > Graham
> > > > > | > | > > > > AB-Write >< Professional AFL Writing Service
> > > > > | > | > > > > Yes, I write AFL code to your requirements
> > > > > | > | > > > > http://e-wire.net.au/~eb_kavan/ab_write.htm
> > > > > | > | > > > >
> > > > > | > | > > > >
> > > > > | > | > > > >
> > > > > | > | > > > > 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 other support material please check also:
> > > > > | > | > > > > http://www.amibroker.com/support.html
> > > > > | > | > > > >
> > > > > | > | > > > >
> > > > > | > | > > > > Yahoo! Groups Links
> > > > > | > | > > > >
> > > > > | > | > > > >
> > > > > | > | > > > >
> > > > > | > | > > > >
> > > > > | > | > > > >
> > > > > | > | > > > >
> > > > > | > | > > > >
> > > > > | > | > > >
> > > > > | > | > > >
> > > > > | > | > > > --
> > > > > | > | > > > Janeczko for President!
> > > > > | > | > >
> > > > > | > | > >
> > > > > | > | > >
> > > > > | > | > >
> > > > > | > | > >
> > > > > | > | > > 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 other support material please check also:
> > > > > | > | > > http://www.amibroker.com/support.html
> > > > > | > | > >
> > > > > | > | > >
> > > > > | > | > > Yahoo! Groups Links
> > > > > | > | > >
> > > > > | > | > >
> > > > > | > | > >
> > > > > | > | > >
> > > > > | > | > >
> > > > > | > | > >
> > > > > | > | > >
> > > > > | > | > >
> > > > > | > | >
> > > > > | > | >
> > > > > | > | > --
> > > > > | > | > Janeczko for President!
> > > > > | > |
> > > > > | > |
> > > > > | > |
> > > > > | > |
> > > > > | > | ------------------------ Yahoo! Groups Sponsor
> > -------------------
> > > > > | -~--
> > > > > | > | >
> > > > > | > | Help Sudanese refugees rebuild their lives through
> > GlobalGiving.
> > > > > | > | http://us.click.yahoo.com/hjNroD/EbOLAA/cosFAA/GHeqlB/TM
> > > > > | > |
> > ------------------------------------------------------------------
> > > > > | --~-
> > > > > | > | >
> > > > > | > |
> > > > > | > | 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 other support material please check also:
> > > > > | > | http://www.amibroker.com/support.html
> > > > > | > |
> > > > > | > |
> > > > > | > | Yahoo! Groups Links
> > > > > | > |
> > > > > | > |
> > > > > | > |
> > > > > | > |
> > > > > | >
> > > > > | >
> > > > > | >
> > > > > | >
> > > > > | >
> > > > > | > 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 other support material please check also:
> > > > > | > http://www.amibroker.com/support.html
> > > > > | >
> > > > > | >
> > > > > | > Yahoo! Groups Links
> > > > > | >
> > > > > | >
> > > > > | >
> > > > > | >
> > > > > | >
> > > > > | >
> > > > > | >
> > > > > |
> > > > > |
> > > > > | --
> > > > > | Janeczko for President!
> > > > > |
> > > > > |
> > > > > | ------------------------ Yahoo! Groups Sponsor
> > --------------------~--
> > > > > | >
> > > > > | Put more honey in your pocket. (money matters made easy).
> > > > > | http://us.click.yahoo.com/r7D80C/dlQLAA/cosFAA/GHeqlB/TM
> > > > > |
> > --------------------------------------------------------------------~-
> > > > > | >
> > > > > |
> > > > > | 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 other support material please check also:
> > > > > | http://www.amibroker.com/support.html
> > > > > |
> > > > > |
> > > > > | Yahoo! Groups Links
> > > > > |
> > > > > |
> > > > > |
> > > > > |
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > 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 other support material please check also:
> > > > http://www.amibroker.com/support.html
> > > >
> > > >
> > > > Yahoo! Groups Links
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> > > --
> > > Cheers
> > > Graham
> > > AB-Write >< Professional AFL Writing Service
> > > Yes, I write AFL code to your requirements
> > > http://e-wire.net.au/~eb_kavan/ab_write.htm
> > 
> > 
> > 
> > 
> > 
> > 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 other support material please check also:
> > http://www.amibroker.com/support.html
> > 
> > 
> > Yahoo! Groups Links
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> 
> 
> -- 
> Cheers
> Graham
> AB-Write >< Professional AFL Writing Service
> Yes, I write AFL code to your requirements
> http://e-wire.net.au/~eb_kavan/ab_write.htm




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Put more honey in your pocket. (money matters made easy).
http://us.click.yahoo.com/r7D80C/dlQLAA/cosFAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

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 other support material please check also:
http://www.amibroker.com/support.html

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/