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

Re: [amibroker] IIf function



PureBytes Links

Trading Reference Links

This should work as well

ChPct = ROC(C,1);
ChCol = IIf(ChPct>=Ref(ChPct,-1), colorGreen, colorRed);
Title = EncodeColor(LastValue(ChPct)) + WriteVal(ChPct,1.2);

Bruce
Perth, Australia

-----Original Message-----
Subject: [amibroker] IIf function

Would someone please explain to me why the following code fragment 
does not work.  It is part of an IB formula for a price display.

ChPct = ROC(C,1);
ChCol = IIf(ChPct>=Ref(ChPct,-1), colorGreen, colorRed);
Title = EncodeColor(ChCol) + WriteVal(ChPct,1.2);

When I try to apply it I get the response "Bad args.  0-th argument 
of function call has invalid (or unsupported) type", and also "Error 
1. Operation not allowed".

The problem is the condition in the IIf function.  I can replace 
line 2 with "ChCol = colorGreen" and it works.  I can substitute a 1 
or a 0 for the condition and get the color switches.  The condition 
I have set up must evaluate to True (1) or False (0).  What am I not 
seeing?  Thanks for any enlightenment.

HHP


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for Your HP, Epson, Canon or Lexmark
Printer at Myinks.com. Free s/h on orders $50 or more to the US & Canada. http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/l.m7sD/LIdGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

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