Ok …
Try this …
Plot(IIf((MCD1 < MCD2 AND MCD1 < 0) OR
(MCD1 > MCD2 AND MCD1 > 0), MCD2, MCD1), "",
IIf((MCD1 < MCD2 AND MCD1 < 0) OR (MCD1 > MCD2 AND MCD1 > 0), colorRed, colorBlue), styleHistogram);
Plot(IIf((MCD1 < MCD2 AND
MCD1 < 0) OR
(MCD1 > MCD2 AND MCD1 > 0), MCD1, MCD2), "",
IIf((MCD1 < MCD2 AND MCD1 < 0) OR (MCD1 > MCD2 AND MCD1 > 0), colorBlue, colorRed), styleHistogram);
From: Ken Close
[mailto:ken45140@xxxxxxxxx]
Sent: Thursday, August 16, 2007
1:39 PM
To: amibroker@xxxxxxxxxxxxxxx
Cc: 'Fred
Tonetti'
Subject: RE: [amibroker] Re:
Controlling GraphZOrder on Bar by Bar Basis
Fred:
thanks, while your code does not "quite" do it, it is conceptually
correct. It is hard to describe why your code is not "quitre" right.
I will try posting a graphic even thou it will not be saved. I think you
get individual messages so you should see what I mean by not "quite"
right.
So far, my various attempts to alter the logic within the Plot have not
produced the correct result.
I am using MACD of RUT and DJ30 with
shortema=50 and longema = 200
-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx]
On Behalf Of Fred
Sent: Thursday, August 16, 2007 12:03 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Re: Controlling GraphZOrder on Bar by Bar Basis
Oh I get it ...
Try this ...
A1 = AMA(C, 2 / (12 + 1));
A2 = AMA(C, 2 / (26 + 1));
MCD1 = A1 - A2;
MCD2 = AMA(MCD1, 2 / (9 + 1));
Plot(IIf((MCD1 < MCD2 AND MCD1 < 0) OR (MCD1 > MCD2 AND MCD1 > 0),
MCD2, MCD1), "1", IIf(MCD1 < MCD2, colorRed, colorBlue),
styleHistogram);
Plot(IIf((MCD1 < MCD2 AND MCD1 < 0) OR (MCD1 > MCD2 AND MCD1 > 0),
MCD1, MCD2), "2", IIf(MCD1 < MCD2, colorBlue, colorRed),
styleHistogram);
--- In amibroker@xxxxxxxxxxxxxxx, "Fred" <ftonetti@xxx> wrote:
>
> When posting code it would be good if you at least provided he
source
> for datanames so that potential helpers don't have to make their own
> ...
>
> Plot works on arrays as you have written your statements not on points
> in the array so a loop would be at best superfluous.
>
> It would appear the only thing you are potentially changing from
one
> bar to the next is color so without the WriteVal's ...
>
> Plot(MCD2, "", IIf(MCD1 < MCD2, colorRed, colorBlue),
> styleHistogram); Plot(MCD1, "", IIf(MCD1 < MCD1, colorBlue,
colorRed),
> styleHistogram);
>
>
> --- In amibroker@xxxxxxxxxxxxxxx, "Ken Close" <ken45140@>
wrote:
> >
> > 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); } }
> >
>
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to SUPPORT {at}
amibroker.com
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:amibroker-digest@xxxxxxxxxxxxxxx
mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/