[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Gradient Coloring



PureBytes Links

Trading Reference Links

Hi folks,

I have a neat TradeStation RadarScreen indicator that I am trying to
duplicate with Amibroker.  I like to display were today's close ends
up in relation to today's trading range as well as the 21 day period
and 52 week period.  But I have the cell change from Red (0%) to Green
(100%).  

I am close but it's not quite what I want as with AB and the ColorHSB
function it displays too many colors in between Red and Green and
isn't a Gradient between just those two colors.

If anyone can think of a way to do this please let me know.

Here is the code for determining the % range over today, 21 days, 250
days and displaying those values as well as changing of the background
cell in an Exploration Results window.


//  % of 1 Day, 21 Day, and 250 Day Range
P1TR = ( (C - L) / (H - L) ) * 100 ; 																// formula to
calculate the close % of today's range
AddColumn(P1TR, "% 1DR", 3.1,  colorBlack,
ColorHSB(P1TR,255,255), 50);						// Display the % of today's range
that the close was at

HH = HHV(H,21);																						// Highest High over last 21 days
LL = LLV(Low,21);																						// Lowest Low over last 21 days
P21DR = ( (Close - LL) / (HH - LL) ) * 100;														// Calculate
where the close is in relation to this 21 day range
AddColumn(P21DR, "%21DR", 3.1, colorBlack,
ColorHSB(P21DR,255,255), 60);					// Display this value (% of 21 Day
Range)

HH250 = HHV(H,250);																					// Highest High over last 250 days
LL250 = LLV(L,250);																					// Lowest Low over last 250 days
P250DR = ( (Close - LL250) / (HH250 - LL250) ) * 100;											//
Calculate where the close is in relation to this 250 day range
AddColumn(P250DR, "%250DR", 3.1, colorWhite,
ColorHSB(P250DR,255,255), 60);					// Display this value (% of 250 Day
Range)

// Display various trading range values
AddColumn(H-L, "T R", 2.2, colorWhite, colorDarkRed,50);										//
adds a column for today's range
AddColumn(ATR(5), "5d ATR ", 2.2, colorWhite,
colorDarkRed,60);								// adds a column for 5 day ATR
AddColumn(ATR(21), "21d ATR", 2.2, colorWhite,
colorDarkRed,60);								// adds a column for 21 day ATR


I plan to work on this but thought I would post what I have tried so far.

Regards,

Dave
MarketMonk777