PureBytes Links
Trading Reference Links
|
Dimitris,
It works because of implict cast from number to string that occurs if expression type
is string. This was described in one of the read-me over one year ago.
Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message -----
From: "DIMITRIS TSOKAKIS" <TSOKAKIS@xxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Tuesday, April 13, 2004 8:23 AM
Subject: [amibroker] Re: pls help: using AddToComposite in for-statement
> Frankly speaking, I do not know how "~ticker"+n works [we add a
> string+number, I would prefer "~ticker"+writeval(n,1.0) ] but, it
> works !!
> Dimitris Tsokakis
> --- In amibroker@xxxxxxxxxxxxxxx, "treliff" <treliff@xxxx> wrote:
> > This works as well, indeed I was looking for the first solution.
> Btw
> > I was wondering how in my efforts I could have missed "~ticker"+n
> > but looking back it turns out I had in fact written the "n"
> > first, like n+"~ticker" and that does lead to an error. Thanks
> > Dimitris for your help and explanations.
> >
> > -treliff
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, "DIMITRIS TSOKAKIS"
> > <TSOKAKIS@xxxx> wrote:
> > > The
> > > for(n=10;n<=50;n=n+10)
> > > {
> > > AddToComposite(StochD(n),"~ticker"+n,"C");
> > > Buy=0;
> > > }
> > > will create 5 tickers ~ticker10, ~ticker20,~ticker30,~ticker40
> and
> > > ~ticker50.
> > > For example, ~ticker30 will give the sum of daily StochD(30) for
> > all
> > > stocks.
> > > The
> > > for(n=10;n<=50;n=n+10)
> > > {
> > > AddToComposite(StochD(n),"~ticker"+"n","C");
> > > Buy=0;
> > > }
> > > will create only ~tickern, "n" now is a string.
> > > ~tickern will give the daily
> > > StochD(10)+ StochD(20)+ StochD(30)+ StochD(40)+ StochD(50)
> > > for all stocks.
> > > Both runs are error free.
> > > I think you search for the first solution.
> > > Dimitris Tsokakis
> > > --- In amibroker@xxxxxxxxxxxxxxx, "treliff" <treliff@xxxx> wrote:
> > > > Are there Expert Users that can advise me on the (im)
> possibility
> > of
> > > > using AddToComposite in a for-statement, such that with each
> > loop a
> > > > new artificial ticker symbol is created, essentially something
> > like:
> > > >
> > > > for (n=1;n<=20;n++)
> > > > { AddToComposite(f(n),"Ticker+"n"","O"); }
> > > >
> > > > with f some function, such that Ticker1 holds the result of f
> (1)
> > in
> > > > the Open field, Ticker2 the result of f(2) etc.
> > > >
> > > > I've been shooting blindly a while now trying things like
> > > >
> > > > "Ticker"+"n"
> > > > "Ticker"+n
> > > > etc.
> > > >
> > > > but I keep getting an error message, I can't get
> > AddToComposite's
> > > > ticker field to recognize "n" as the loop variable. Is this
> (im)
> > > > possible?
> > > >
> > > > Appreciate your advice.
> > > >
> > > > -treliff
>
>
>
> Send BUG REPORTS to bugs@xxxxxxxxxxxxx
> Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
> -----------------------------------------
> Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
> (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> --------------------------------------------
> Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> Yahoo! Groups Links
>
>
>
>
>
>
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.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/
|