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

RE: [amibroker] AFL syntax for nested IIF ?



PureBytes Links

Trading Reference Links

Perhaps Herman was confused because the basic question could be answered
just by looking in the help file.  Herman probably thought you wanted
something more (especially since you included [ ] in your example, implying
you wanted to work on single array elements.
 
>From Help:
 
iif( EXPRESSION, TRUE_PART, FALSE_PART ) 

Actually this is used by making a new variable equal to the result of the
IIF function for the entire array.
 
NewVarName = IIF(Expression, TruePart, FalsePart);
 
There is usually no equivalence set in the True and False parts, just
calculations, the result of which is assigned to the NewVarName.
 
 
  _____  

From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf
Of Ton Sieverding
Sent: Wednesday, February 14, 2007 2:58 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: Re: [amibroker] AFL syntax for nested IIF ?


Thanks Herman. I know that in programmers land there are a thousand possible
ways to Rome. I even can put all the to do's in a function and then call the
function from within the IIF etc. etc. But that's not how it should be
programmed and that's not my question. I just don't know the syntax of the
double IIF in AFL and would like to know that. The frustrating thing for me
is that I cannot find it in the AFL manual. Don't forget that in AFL the
double IIF has a special function. It made to handle arrays. So there is no
need for a loop ...
 
Ton.
 

----- Original Message ----- 
From: Herman <mailto:psytek@xxxxxxxx>  
To: amsiev <mailto:amibroker@xxxxxxxxxxxxxxx>  
Sent: Wednesday, February 14, 2007 7:23 PM
Subject: Re: [amibroker] AFL syntax for nested IIF ?



Not sure what you are trying to do but often using a loop may simplify
things:




FirstVisibleBar = Status( "FirstVisibleBar" );

Lastvisiblebar = Status("LastVisibleBar");

for( b = Firstvisiblebar; b < Lastvisiblebar AND b < BarCount; b++)

       {

       if( BarNumAct[b] <= 21 )

               {

               Highs[b] = C[b];

               Lows[b] = C[b];

               Range[b] = (H[b] - L[b])/2;

               }

       }




herman




Wednesday, February 14, 2007, 12:39:24 PM, you wrote:




> 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/> > http://www.amibroker.com/devlog/




> For other support material please check also:

 <http://www.amibroker.com/support.html> >
http://www.amibroker.com/support.html

>  

> Yahoo! Groups Links




>     http://groups. <http://groups.yahoo.com/group/amibroker/>
yahoo.com/group/amibroker/




>     Individual Email | Traditional




>     http://groups. <http://groups.yahoo.com/group/amibroker/join>
yahoo.com/group/amibroker/join

>     (Yahoo! ID required)




>     mailto:amibroker- <mailto:amibroker-digest@xxxxxxxxxxxxxxx>
digest@xxxxxxxxxxxxxxx 

>     mailto:amibroker- <mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx>
fullfeatured@xxxxxxxxxxxxxxx




>     amibroker-unsubscri <mailto:amibroker-unsubscribe@xxxxxxxxxxxxxxx>
be@xxxxxxxxxxxxxxx




>     http://docs. <http://docs.yahoo.com/info/terms/> yahoo.com/info/terms/

>  



 

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