Just thought of a way around the plotorder thing. With this version 
there is no need for a ribbon_nr parameter.

Johan




SetBarsRequired( 10000, 0 );
Count = 0;
GraphXSpace = 0;
Title = "";

procedure ribbon( Caption, Color ) {

   firstbar = Status( "firstvisiblebarindex" );
   lastbar = Status( "lastvisiblebarindex" );

   xOffset = ( lastbar - firstbar ) / 100;
   yOffset = 0.5;

   y2 = ++Count;
   y1 = y2 - 1;
   
   Plot( y2, "", colorBlack, styleLine | styleNoLabel );
   Plot( 0, "", colorBlack, styleNoDraw );
   Plot( y2, "", Color, styleArea | styleNoLabel );
   PlotText( Caption, firstbar + xOffset, y2 - yOffset, colorBlack );

}

colorRSI = IIf( RSI() > 70, colorRed, IIf( RSI() < 30,
colorGreen, colorYellow ) );

colorMACD = IIf( MACD() > Signal(), colorGreen, colorRed );

ribbon( "MACD", colorMACD );
ribbon( "RSI-14", colorRSI );
ribbon( "MA20", IIf( C > MA( C, 20 ), colorGreen, colorRed ) );









--- In amibroker@yahoogroups.com, "johsun" <[EMAIL PROTECTED]> wrote:
>
> Dave,
> 
> Yes I think I see the problem now, even though I can see your 
> attachments.
> 
> It's the width thing that I mentioned - the change won't be 
visible 
> until the day after, and like you said that is obviously too late.
> Below is my revised code - I've gone back to using styleArea. The 
> reason I wanted to use styleCloud is that you won't have to keep 
> track of the plotorder, no plot will cover another. But styleArea 
> will work just fine as long as you keep this in mind.
> 
> Johan
> 
> 
> 
> procedure ribbon( ribbon_nr, Caption, Color ) {
> 
>    firstbar = Status( "firstvisiblebarindex" );
>    lastbar = Status( "lastvisiblebarindex" );
> 
>    xOffset = ( lastbar - firstbar ) / 100;
>    yOffset = 0.5;
> 
>    y2 = ribbon_nr;
>    y1 = y2 - 1;
>    
>    Plot( y2, "", colorBlack, styleLine | styleNoLabel );
>    Plot( 0, "", colorBlack, styleNoDraw );
>    Plot( y2, "", Color, styleArea | styleNoLabel );
>    PlotText( Caption, firstbar + xOffset, y2 - yOffset, 
colorBlack );
> 
> }






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 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/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to