Hi Rick, Hey that works for me! Thanks. Can you explain for a non programmer what the StrToNum and then NumToStr functions are actually doing in this case? It seems circular to me (convert a string to a number and then back to a string), so I don't understand what is being accomplished, or why this is necessary.
Yuki Sunday, June 13, 2010, 5:52:21 AM, you wrote: RO> Yuki RO> I have the following code which changes the background gradient RO> color depending on whether a buy or sell signal is given. RO> if(StrToNum(NumToStr(BuySignal))) RO> bgColor = ColorRGB(0,66, 2); RO> else RO> bgColor = ColorRGB(66,2, 0); RO> SetChartBkGradientFill( colorBlack, bgColor); RO> RO> Perhaps you can change this to meet your needs RO> Best Regards RO> Rick Osborn RO> ________________________________ RO> From: Yuki Taga <[email protected]> RO> To: [email protected] RO> Sent: Sat, June 12, 2010 1:24:58 AM RO> Subject: [amibroker] impenetrable AFL RO> RO> Impenetrable! (At least to me.) RO> xcolor = IIf(TSI >= SigLine, SetChartBkGradientFill( RO> ParamColor("BgTop", ColorRGB( 172,172,172 )), RO> ParamColor("BgBottom", ColorRGB( 172,172,172 ))), RO> SetChartBkGradientFill( ParamColor("BgTop", ColorRGB(140,140,140)), RO> ParamColor("BgBottom", ColorRGB(140,140,140)))); RO> SetChartBkColor(SelectedValue(xcolor)); RO> I tried that line above as RO> SetChartBkGradientFill(SelectedValue(xcolor)); but that produced a RO> syntax error. RO> I think you can see what I'm trying to do here. The idea is simple: RO> change the background gradient depending on a true/false result. The RO> gradients in this example are not the gradients I would actually use RO> (in fact they are not gradients at all, as your intelligent eyes will RO> quickly have seen). They are just test code to see if I can even RO> make it work. I cannot. RO> For one thing, the gradient does not change no matter the selected RO> value. It's static. For another thing, the margin background goes RO> to black, a hideous (although somewhat foreseen) result. RO> Okay, what am I doing wrong, and where did I miss this in the docs? RO> And what, if anything, can I do about this margin result? The only RO> way I can change the *entire* background color is by not using a RO> gradient??? (Using SetChartBkColor) How sad that would be! I can RO> make that work, at least. But not with a gradient. RO> Anything is possible in Amibroker, right? RO> Wrong? RO> Thanks, RO> Yuki RO>
