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

Re: [amibroker] AFL syntax for nested IIF ?



PureBytes Links

Trading Reference Links

Here is correct and simplest method using IIF to create the array of
values for each variable
highbar = iif(barnum < 21,  C , null );
lowbar =  iif(barnum < 21, C , null );
range = iif(barnum < 21, C, null);

If you are needing to use IF, then this only accepts arrays if you
place it withon a FOR loop and use array identifiers. But for this
simple application then IIF is the quickest and simplest way to go.


-- 
Cheers
Graham
AB-Write >< Professional AFL Writing Service
Yes, I write AFL code to your requirements
http://www.aflwriting.com


On 15/02/07, wavemechanic <fimdot@xxxxxxxxx> wrote:
>
>
> Your use of IIF() is wrong - Users Guide "Common  Coding Mistakes."  If I correctly understand what you are after then this  should work:
>
> x = iif(barnum < 21, highbar = c and lowbar = c and  range = c, null);
>
> Bill
>
>
> ----- Original Message -----
> From: "amsiev" <ton.sieverding@xxxxxxxxxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Wednesday, February 14, 2007 12:39  PM
> Subject: [amibroker] AFL syntax for nested IIF  ?
>
> >  What's the syntax in AFL for a double IF with following structure ?
> >
> > IF True
> >       Do This  ;
> >       Do That  ;
> >       Do anything;
> > Endif
> >
> > I'm working with arrays so I must use the double IF but my problem is
> > that I just cannot get the correct syntax. There are in fact two
> > problemens. First I only want the IIF to do something when the
> >  condition is true. Therefore I don't want the third part in case the
> >  IIF is false or the 'Do if false'. Second I want the IIF to do
> > several  things. Not just one. Following syntax is wrong. So what's
> > the correct  one ?
> >
> > IIf(BarNumAct<=21,
> > {
> > Highs[BarNumAct]  = Close;
> > Lows[BarNumAct]  = Close;
> > Range[BarNumAct] = (High  - Low)/2;
> > }
> > ,"");
> >
> >
> >
> > 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
> >
> >
> >
> >
> >
> >
> > --
> > No virus found  in this incoming message.
> > Checked by AVG Free Edition.
> > Version:  7.5.441 / Virus Database: 268.17.39/685 - Release Date: 2/13/2007 10:01  PM
> >
> > 

Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.441 / Virus Database: 268.17.39/687 - Release Date: 2/14/2007 4:17 PM