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

Re: [amibroker] IIf Function



PureBytes Links

Trading Reference Links

Hi John,

As for IIF:

IIF is a function - this means that it must "return" the value

result_array = IIF( condition_array, true_array, false_array );

It works in such a way that each element of condition_array is
checked for true or false, if it is true - corresponding element
of true_array is assigned to result_array if it is false - corresponding
element of false_array is assigned to result_array.

In basic-like language this looks like this

for i = 0 to array_size
if condition_array[ i ] = 1
then
result_array[ i ] = true_array[ i ]
else
result_array[ i ] = false_array[ i ] 
end if
next 

As you can see false_array is required.

> ADX>14 then plot EMA of 20. Actually what I want is to know when the 
> stock rises and touches the EMA 20.
What you want to achieve is possible without
using any IIFs:

buy = cross( close, ema( close, 20 ) AND adx( 14 ) > 15;
// this gives you a buy signal when close rises above EMA 20 
// but ONLY WHEN adx( 14 ) is greater than 15


Best regards,
Tomasz Janeczko
===============
AmiBroker - the comprehensive share manager.
http://www.amibroker.com


----- Original Message ----- 
From: "John" <jar5499297@xxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Friday, May 25, 2001 3:50 PM
Subject: [amibroker] IIf Function


> A question if I may, in regards to the iif function, Amibroker 
> Formula Language says...The iif() function is used to create 
> conditional (i.e., "if-then") statements. It contains three 
> parameters as shown in the following example.
> 
> Do you need three parameters? I'm trying to do two and am having 
> difficulity. Is there another function I should be using?
> 
> ADX>14 then plot EMA of 20. Actually what I want is to know when the 
> stock rises and touches the EMA 20.
> 
> Thanks
> 
> John
> 
> 
> 
> 
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 
> 
>