Hi Johan,

This is cool.  I am now learning how to use functions.  Could we take this
one step further and put these functions (and all functions) in an #include
file?

Dave 

-----Original Message-----
From: amibroker@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf
Of johsun
Sent: Monday, July 31, 2006 9:13 AM
To: amibroker@yahoogroups.com
Subject: [amibroker] Re: Multi Row Colored Ribbons

Okay..

Last version I hope:)

Cleaned it up a bit ( no need for the y1 variable anymore ) and added a
Xday_range_gradient function.

Johan






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

procedure ribbon( Caption, Color ) {

Count++;

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

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

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

}


function Xday_range_gradient( period ) {

  range_top = HHV( H, period );
  range_bot = LLV( L, period );
  price_pos = ( ( C - range_bot ) / ( range_top - range_bot ) );
  G = 255 * price_pos;
  R = 255 - G;
  return ColorRGB( R, G, 0 );

}

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

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


ribbon( "RSI-14", colorRSI );
ribbon( "MACD", colorMACD );
ribbon( "21-day range", Xday_range_gradient( 21 ) ); ribbon( "250-day
range", Xday_range_gradient( 250 ) );





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



 





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