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

[amibroker] A simple improvement to colored Bollinger Bands



PureBytes Links

Trading Reference Links

For those of you who found the Colored Bollinger Bands useful, I have made a slight change to make it a bit more eye appealing, by coloring area between Bands.

 

Below find the code. 

 

Enjoy,

Don Lindberg

-------------------- Cut Here -------------------------------------

//Colored Bollinger Bands with Price

 

_SECTION_BEGIN("Price");

SetChartOptions(0,chartShowArrows|chartShowDates);

_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));

Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );

_SECTION_END();

 

_SECTION_BEGIN("Colored Bollinger Bands");

 

pr=Param( "Period",20,0,100,1);

P = ParamField("Price field",-1);

Style = ParamStyle("Style") | styleNoRescale | styleNoLabel |styleDashed;

 

 BBT=BBandTop(P,pr,2);

 BBB=BBandBot(P,pr,2);

 

topcond = (Cross(BBT,C)OR C>BBT)AND Ref(C, -1)> BBT;

botcond = ( Cross(C,BBB))AND Ref(C, -1 < BBB);

 

bbtcolor = IIf( BBT> Ref (BBT, -1), colorDarkGreen,colorRed );

bbbcolor = IIf( BBB > Ref (BBB, -1), colorDarkGreen,colorRed );

 

 Plot( BBT, "BBTop" + _PARAM_VALUES(), bbtcolor, styleLine|styleThick);

 Plot( BBB, "BBBot" + _PARAM_VALUES(), bbbcolor, styleLine|styleThick );

 

PlotOHLC( BBT,BBT,BBB,BBB, "", colorRose,styleCloud );

 

Buy=botcond;

Sell=topcond ;

// If you feel there are too many arrows you can un-comment the next two lines.

//Buy=ExRem(Buy,Sell);

//Sell=ExRem(Sell,Buy);

 

PlotShapes(shapeUpArrow * Buy, colorGreen, 0, L, - 10);

PlotShapes(shapeDownArrow * Sell, colorRed, 0, H, - 10);

 

 _SECTION_END();

 

-------------------- Cut Here -------------------------------------

 

__._,_.___

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





SPONSORED LINKS
Investment management software Investment property software Investment software
Investment tracking software Return on investment software

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___