PureBytes Links
Trading Reference Links
|
Hello,
> n=1;
> ticker=WriteIf(n==1,"COMPQX","NDX--X");
> SetForeign(ticker);
Yes that one possiblity. Second solution is to use if-else statement
(not IIF function). The difference (as explained in the user's guide
http://www.amibroker.com/guide/a_language.html )
is that "if-else" is a FLOW-CONTROL STATEMENT, while IIF is just a FUNCTION
that does NOT change the flow of execution (all arguments are evaluated always).
So to change the FLOW you need to use 'if-else' statement:
if( n == 1 )
{
SetForeign( "COMPQX" );
}
else
{
SetForeign("NDX--X" );
}
Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message -----
From: "johsun" <johanskatt@xxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Saturday, February 28, 2004 4:48 PM
Subject: [amibroker] Re: SetForeign problem.,..
> Try,
>
>
> JS
>
>
> --- In amibroker@xxxxxxxxxxxxxxx, "Keith Bennett" <kbennett@xxxx>
> wrote:
> >
> > The code snippet below doesn't seem to be valid.
> >
> > n=1;
> > IIf(n=1,SetForeign("COMPQX"),SetForeign("NDX--X"));
> >
> > I want to use one of two index tickers depending on the value of
> n.
> > Is there some other way to achieve this.
> >
> > TIA
> > Keith
>
>
>
>
> 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
>
>
>
>
>
>
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/
|