That's interesting code, Rick. Can you explain me why this works ? 1. First I assume BuySignal to be BUY. Therefore being an array. So IF should not work. Should be IIF. But even when I put there BUY to be sure it's an array, it does work. Why ?
2. What's the difference between StrToNum(NumtoStr(BUY)) and BUY ? Should give me the same result. But is does not. Without this trick I cannot use IF. What's going on here ???? Regards, Ton. ----- Original Message ----- From: Rick Osborn To: [email protected] Sent: Saturday, June 12, 2010 10:52 PM Subject: Re: [amibroker] impenetrable AFL Yuki I have the following code which changes the background gradient color depending on whether a buy or sell signal is given. if(StrToNum(NumToStr(BuySignal))) bgColor = ColorRGB(0,66, 2); else bgColor = ColorRGB(66,2, 0); SetChartBkGradientFill( colorBlack, bgColor); Perhaps you can change this to meet your needs Best Regards Rick Osborn ------------------------------------------------------------------------------ From: Yuki Taga <[email protected]> To: [email protected] Sent: Sat, June 12, 2010 1:24:58 AM Subject: [amibroker] impenetrable AFL Impenetrable! (At least to me.) xcolor = IIf(TSI >= SigLine, SetChartBkGradientFill( ParamColor("BgTop", ColorRGB( 172,172,172 )), ParamColor("BgBottom", ColorRGB( 172,172,172 ))), SetChartBkGradientFill( ParamColor("BgTop", ColorRGB(140,140,140)), ParamColor("BgBottom", ColorRGB(140,140,140)))); SetChartBkColor(SelectedValue(xcolor)); I tried that line above as SetChartBkGradientFill(SelectedValue(xcolor)); but that produced a syntax error. I think you can see what I'm trying to do here. The idea is simple: change the background gradient depending on a true/false result. The gradients in this example are not the gradients I would actually use (in fact they are not gradients at all, as your intelligent eyes will quickly have seen). They are just test code to see if I can even make it work. I cannot. For one thing, the gradient does not change no matter the selected value. It's static. For another thing, the margin background goes to black, a hideous (although somewhat foreseen) result. Okay, what am I doing wrong, and where did I miss this in the docs? And what, if anything, can I do about this margin result? The only way I can change the *entire* background color is by not using a gradient??? (Using SetChartBkColor) How sad that would be! I can make that work, at least. But not with a gradient. Anything is possible in Amibroker, right? Wrong? Thanks, Yuki
