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

[amibroker] Trying to duplicate Excel "IF" statement in Amibroker using "IIF"



PureBytes Links

Trading Reference Links


In Excel I have an "IF" statement that tells what to display in a 
cell, like this:

=IF(E65>MAX(E25:E64),1,IF(AND(H64=1,E65<MIN(E45:E64)),0,H64))

The "E" column is closing security prices, the "H" column displays a 1 
or 0 telling me whether the trend is up or down, and the formula 
continues all the way down to the last row of closing prices.  If 
there's no change from the previous day's value in column "H", the 
previous day's value is displayed. 

I don't need AB to do anything with the result, just display the 
result, so I think I need to use "IIF" and not "IF-ELSE" or looping.
(??)

I have Cond1 defined as being the upside breakout (MAX) and Cond2 as 
the downside breakdown (MIN). Cond3 is the IIF statement I'm trying to 
create, like this:

Cond3=IIF(Cond1==1,1,IIF(Ref(Cond3,-1)==1 AND IIF(Cond2==1)),0,Ref
(Cond3,-1);

Then I'll use Cond3's output of 1 or 0 as a binary signal to identify 
uptrend or downtrend.

I can't get it to work for me, though.  The AFL checker tells me I'm 
using Cond3 before it's been initialized, but I don't know how to get 
around that.

TIA for any guidance, and it's okay to laugh if I did something really 
dumb.:)


Luck to all,

Sebastian 









------------------------ Yahoo! Groups Sponsor --------------------~--> 
What would our lives be like without music, dance, and theater?
Donate or volunteer in the arts today at Network for Good!
http://us.click.yahoo.com/Tcy2bD/SOnJAA/cosFAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

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 other support material please check also:
http://www.amibroker.com/support.html

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/