Here is an example:

 

price = SelectedValue(C);

Title = EncodeColor(IIf(price<20,colorBlue,colorRed))+" asdkfajf";

 

When you use selectedvalue you don’t need the lastvalue because in this case you don’t use an array.

 

In your code below you use BPrice which is probably of array type.

So you would have to use lastvalue(BPrice)

However this is not what you would like to show. In other words it would not work on bar by bar basis

with the selected value. You could only calculate something from the selected value to the LAST BPrice.

 

Best Regards

 

Thomas

www.tradingbasis.com

 


From: [email protected] [mailto:[email protected]] On Behalf Of Ken Close
Sent: Tuesday, August 29, 2006 3:22 PM
To: [email protected]
Subject: RE: [amibroker] Conditional Encodecolor

 

Thanks Thomas but where do I put the LastValue??

 

Here is code snippit I am trying:

AboveBuy = 100*(SelectedValue(C) - BPrice)/BPrice;

ColorABuy = IIf(AboveBuy>0,1,0);  <<<<<<<<<  lastValue Here???????????

AboveStop = 100*(SelectedValue(C) - Stop)/Stop;

ColorAStop = LastValue(IIf(AboveStop>0,colorGreen,colorRed));  <<<<<<<<<<<<<< Or lastvalue here??

Title = EncodeColor(colorBlue) + Name() + " " + FullName() + " " + Date() + "\n" +

"Above Buy = " + EncodeColor(colorGreen) + WriteVal(AboveBuy) + "% " +

EncodeColor(colorBlue) + "Above Stop = " + EncodeColor(colorAstop) + WriteVal(AboveStop

 


From: [EMAIL PROTECTED]ps.com [mailto:amibroker@yahoogroups.com] On Behalf Of Thomas Z.
Sent: Tuesday, August 29, 2006 9:03 AM
To: [EMAIL PROTECTED]ps.com
Subject: RE: [amibroker] Conditional Encodecolor

Ken,

 

encodecolor in title doesn’t allow to use arrays.

So you can only use the lastvalue();

 

Best Regards

 

Thomas

www.tradingbasis.com

 


From: [EMAIL PROTECTED]ps.com [mailto:[EMAIL PROTECTED]ps.com] On Behalf Of Ken Close
Sent: Tuesday, August 29, 2006 2:29 PM
To: [EMAIL PROTECTED]ps.com
Subject: [amibroker] Conditional Encodecolor

 

I want to color a value in a Title statement green or red depending on above or below zero.

 

I have tried IIf statements with Encodecolor variables, but keep getting type mismatches or invalid operation in the Title statement.

 

Can someone tell me how to color a value (written with WriteVal) depending on a condition, in a Title statement?

 

Thanks,

 

Ken

__._,_.___

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






SPONSORED LINKS
Software support Small business finance Business finance online
Business finance training Business finance course


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to