Hi Andre,

I don't know about in ALF, but in AFL <vbg> it's certainly possible and easy.  
I'm assuming you want the entire chart to have a different color when the 
condition is true and another color when false, rather than just the indicator 
changing color.  So you can try the following:

XX = C;  // substitute your value here

Indicator1 = MA(c, 5);
Indicator2 = MA(c, 20); 
Indicator3 = MA(c, 50); 

Indicator1_Color = colorblue; 
Indicator2_Color = colorred;
Indicator3_Color = colorplum; 

plot(c, "CLOSE", colorblack, stylecandle); 

Plot(Indicator1, "Indicator 1", Indicator1_color, styleline );
Plot(Indicator2, "Indicator 2", Indicator2_color, styleline );
Plot(Indicator3, "Indicator 3", Indicator3_color, styleline );


Background1_color = colortan;
Background2_color = colorrose;

Cond1 = indicator3 > XX;
cond2 = indicator3 < XX; 

Plot(100, "Close vs Indicator 3", 
    iif(cond1, colortan,
    iif(cond2, colorrose,
    colordefault )), styleownscale|stylearea|stylenolabel|stylenotitle, 0 , 
100, 0, -5);


I wrote the above on the fly (didn't write it within the formula editor), 
however it should work fine unless there is a word-wrap issue. Let me know if 
this is what you want.  For demonstration purposes I simply made the indicators 
to be moving averages with some default periods and the value the close of the 
instrument.  Substitute your own value for XX and indicators for the MAs. 
Similarly you may pick your own colors to suit you. Didn't bother to 
parameterize anything as I don't know what you are really doing or what you are 
trading.

Peace and Justice   ---   Patrick
  ----- Original Message ----- 
  From: [email protected] 
  To: [email protected] 
  Sent: Wednesday, February 03, 2010 9:27 PM
  Subject: [amibroker] Help Needed with formula


  Hi Guys,
  I need to know if the following is possible in ALF.

  I have 3 indicators and a price chart on my screen. When the bottom indicator 
drops below a specified value, I would like to highlight in colour this area, 
however, the colour must extend through the other two indicators and over the 
price chart.

  Does anyone have a clue how to do this?
  cheers
  Andre



  ------------------------------------

  **** IMPORTANT PLEASE READ ****
  This group is for the discussion between users only.
  This is *NOT* technical support channel.

  TO GET TECHNICAL SUPPORT send an e-mail directly to 
  SUPPORT {at} amibroker.com

  TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
  http://www.amibroker.com/feedback/
  (submissions sent via other channels won't be considered)

  For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
  http://www.amibroker.com/devlog/

  Yahoo! Groups Links



Reply via email to