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

[amibroker] Re: Controlling GraphZOrder on Bar by Bar Basis



PureBytes Links

Trading Reference Links

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/