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

Re: [amibroker] AFL syntax for nested IIF ?



PureBytes Links

Trading Reference Links

That's correct Bill. But in stead of using the standard IF I wanted the same thing for the IIF. And that seems to be impossible. As you can see in my first email I already tried your underneath mentioned IF structure for the IIF and got an error message. I then tried all kinds of variations but they all failed. When looking to the IIF internal structure I think it is not made for things like that ...

Ton.

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



  Sounds like what you want is:

  if(your_condition)
  {
      cond1;
      cond2;
      cond3;
  }
  else
  {
      cond1;
      cond2;
  }

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


    Yes you're right, it's impossible to have more actions in one single IIF statement. And therefore the following statement is like you already told me not correct :

    IIF(Barnum > 5, This = 10 AND That = 20 AND Something = 30, Null );

    I did a simple DebugView as Graham suggested. First the condition High>4 and Low>4 are always true and therefore I got HighestHigh = 20 and LowestLow = - 10. Second the condition High>40 and Low>40 are always false and I got HighestHigh = {Empty} and LowestLow = {Empty}. See pictures DI1 and DI2.

    Then I tried the combination of the two actions in one single IIF and got wrong answers. Although I did not get syntax errors. See DI3 and DB4.

    Thanks again for the support ...

    Ton.


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


      This statement is NOT correct ===>>> IIF(Barnum > 5, This = 10 AND That = 20 AND Something = 30, Null );
      The email I sent with each variable independantly assigned is the only way to do this
      Here it is again
      Here is correct and only method using IIF to create the arrays of values for each variable 
      highbar = iif(barnum < 21, C , null );
      lowbar = iif(barnum < 21, C , null );
      range = iif(barnum < 21, C, null);

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




      On 15/02/07, Ton Sieverding <ton.sieverding@xxxxxxxxxx> wrote: 
        Thanks. No my problem is not how to use nested conditions in the double IIF. That's fully explained in the manual. My problem is how to include several actions in the IIF. Since the IIF is an array supporting IF this could create a problem. Of course there are many solutions and Herman as well as Graham showed some of them but that's not what I was looking for. Please read my answers to Herman and Graham. It seems that Bill gave me the correct answer ...

        Ton.


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



          Amisiev, I just created this nested iff for checking the last three days of 
          the close. Is this the kind of thing that you had in mind? You can keep 
          adding as many more iff statements as you like. Ron D

          /*This nested IIf will return a 1 if todays Close, is greater than

          (yesterdays Close, OR the two days ago Close, OR the three days ago Close).

          If todays close is NOT greater than any of the last three closes, then

          this nested iff will return a 0.*/

          NestedIIf=IIf(C>Ref(C,-1),1,IIf(C>Ref(C,-2),1,IIf(C>Ref(C,-2),1,0)));

          Plot(NestedIIf,"rd",colorRed,styleLine);

          ----- Original Message ----- 
          From: "amsiev" <ton.sieverding@xxxxxxxxxx>
          To: <amibroker@xxxxxxxxxxxxxxx>


          Sent: Wednesday, February 14, 2007 11:39 AM
          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