The short answer: Yes, it is. You can approach the problem in two ways: 1.
By coloring the bars/candlesticks (your interest) or 2. By changing the
background colors (my preferred approach). I broke them up in 2 emails, to
keep them short.
In both approaches it is necessary to adjust the range dynamically to the
Total Visible Range. Without doing that one gets lost very easily.
Depending on the volatility you will find that sometimes a close within the
range, other times a H-L within the range is desired. Also, if you want to
use candlesticks you can only change the outline colors and have to manual
adjust the candlestick colors (typically it is sufficient to set only the
Down Color to the background in Preferences; unfortunately that is a global
setting which affects all indicators).
I personally feel, that I spend too much time determining the colors of the
bars and really end up looking at the range itself
//===============Method1: Changing the bar
colors============================
Title = EncodeColor(4)+ _DEFAULT_NAME()+"; "+EncodeColor(1) +
StrFormat("{{NAME}} - {{INTERVAL}}; {{DATE}}; O=%g, H=%g, L=%g, C=%g
(%.1f%%)
{{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) );
//====================== Using Different Price
Colors========================
LVVL=LowestVisibleValue(L);
HVVH=HighestVisibleValue(H);
UpperPrice=round(10000*(LVVL+0.7*(HVVH-LVVL)))/10000; //Forex: Rounding to
get rid of annoying 5th digit; Not strictly necessary
LowerPrice=round(10000*(LVVL+0.4*(HVVH-LVVL)))/10000; //Forex: Rounding to
get rid of annoying 5th digit; Not strictly necessary
UpperBandPrice = Param("UpperBand-Price",UpperPrice,LVVL,HVVH,0.0001);
LowerBandPrice = Param("LowerBand-Price",LowerPrice,LVVL,HVVH,0.0001);
BandColor = ParamColor("Band Color", colorGreen);
OutOfRangeColor = ParamColor("Out of Range Color", colorGrey50);
CloseRangeSel=ParamToggle("Price Selection","Close|Range",0);
StyleSel=ParamToggle("Style Selection","Bar|Candle",0);
if(!CloseRangeSel) //Selects whether C or (H-L) is used as criterion
{Color = IIf( C >= LowerBandPrice AND C<=
UpperBandPrice,BandColor,OutOfRangeColor);}
if(CloseRangeSel)
{Color = IIf( L >= LowerBandPrice AND H<=
UpperBandPrice,BandColor,OutOfRangeColor);}
if(!StyleSel)
{Plot( Close, "Close", Color, styleBar );}
if(StyleSel)
{Plot( Close, "Close", Color, 64 );} //IN Tools/Preferences/Colors:Set DOWN
CANDLESTICK TO THE BACKGROUND COLOR!!!!!!!!
Plot(UpperBandPrice ,"UpperBandPrice ",BandColor ,13);
Plot(LowerBandPrice ,"LowerBandPrice ",BandColor ,13);
From: [email protected] [mailto:[email protected]] On Behalf
Of Potato Soup
Sent: Thursday, December 31, 2009 6:51 PM
To: [email protected]
Subject: [amibroker] Is it possible to color only certain bars in a price
chart based on criteria?
Say if I want all bars that are between a certain range to be red and the
rest blue, or something like that. Is that possible in AB?