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

Re: [amibroker] AFL syntax for nested IIF ?



PureBytes Links

Trading Reference Links

Yes, you can use OR.  However, I did not correctly understand what you were after and wrote the IIF too quickly and incorrectly, as Graham noted.  I think your basic problem is confusion about if(...) and IIF(...) which is explained in the Users Guide.

Bill
  ----- Original Message ----- 
  From: Ton Sieverding 
  To: amibroker@xxxxxxxxxxxxxxx 
  Sent: Thursday, February 15, 2007 3:53 AM
  Subject: Re: [amibroker] AFL syntax for nested IIF ?


  Thanks Bill. Yes my IIF() is wrong. I know that. That's what I told you in my email. And yes in the AFL User Guide there is a short part called 'Common Coding Mistakes' but this only gives a very simple use of the double IIF. Not what I am asking for. That's the reason why I told you in my email that it's rather frustrating that I cannot find the syntax ...

  Although your code does not give me anymore syntax errors, I have a very strange feeling when looking to those 'AND's. Any idea what would happen when I replaced the AND's by OR's ? And why do we need those AND's where in a normal IF we are using brackets ? 
  Anyway as far as I can see it works from a syntax point of view. Thanks again ...

  Ton.


    ----- Original Message ----- 
    From: wavemechanic 
    To: amibroker@xxxxxxxxxxxxxxx 
    Sent: Thursday, February 15, 2007 1:48 AM
    Subject: Re: [amibroker] AFL syntax for nested IIF ?



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

   


------------------------------------------------------------------------------


  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