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

Re: [amibroker] Re: pls help: using AddToComposite in for-statement



PureBytes Links

Trading Reference Links

Maybe some examples can help you, I use to built multiples composites in a
loop:

/*Multiples composites*/

for(Nb=4;Nb<29;Nb++)

{

AddToComposite(IIf(MFI(Nb)>50,1,-1),"~MFI" + WriteVal(Nb,1.0),"X");

Buy=Sell=0;

}


and to plot them, I use:

Comp=0;

Tot=0;

for(nb=4;nb<29;nb++)

{

Ticker=StrFormat("~MFI%g",nb);

//Ticker=StrFormat("~MFI%.0f",nb);

Comp=Foreign(Ticker, "X");

Plot(Comp,Ticker,nb,1);

Tot=Tot+Comp;

}


----- Original Message ----- 
From: "treliff" <treliff@xxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Tuesday, April 13, 2004 5:09 AM
Subject: [amibroker] pls help: using AddToComposite in for-statement


> 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
>
>
>
>
>
>
> __________ NOD32 1.715 (20040411) Information __________
>
> This message was checked by NOD32 antivirus system.
> http://www.nod32.com
>
>



------------------------ 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/