----- Original Message -----
Sent: Thursday, August 16, 2007 5:31
PM
Subject: [amibroker] Controlling
GraphZOrder on Bar by Bar Basis
Seemingly simple
one that is not answered in the help files. Experimenting with bar by
bar for loop and if statements does not work either.
I would like to
plot two simple MACD area plots having similar y axis values.
Assume I make MACD1 Blue in color, MACD2 Red in color.
The GraphZOrder
puts the first plotted variable on top and when the value of MACD1 is less
than the value of MACD2, both are visible (plot in the back is above plot in
the front).
However, when the
value reverses so that MACD1 is greater than MACD2, then MACD2 is hidden from
view (behind the area plot for MACD1).
Is it possible to
"switch" which value is plotted on top so that as the values change, the
greater value variable is always behind the lower value
variable?
Again, my
implmentation of a for loop with an if statement did not work. I used
two Plot statements within the loop.
Any
suggestions?
Thanks,
Ken
for (i = 0; i < BarCount; i++)
{
if
(MCD1[i] < MCD2[i])
{
Plot(MCD2,"
[" + WriteVal(Shrt,1.0) + "/" + WriteVal(lng,1.0) + "] MACD",colorRed,styleHistogram);
Plot(MCD1," [" + WriteVal(Shrt,1.0) + "/" + WriteVal(lng,1.0) + "] MACD",colorBlue,styleHistogram);
}
else
{
Plot(MCD1,"
[" + WriteVal(Shrt,1.0) + "/" + WriteVal(lng,1.0) + "]
MACD",colorBlue,styleHistogram);
Plot(MCD2,"
[" + WriteVal(Shrt,1.0) + "/" + WriteVal(lng,1.0) + "]
MACD",colorRed,styleHistogram);
}
}