Stock Portfolio Organizer

The ultimate porfolio management solution.

Shares, Margin, CFD's, Futures and Forex
EOD and Realtime
Dividends and Trust Distributions
And Much More ....
For Portfolio Manager Click Here

WiseTrader Toolbox

#1 Selling Amibroker Plugin featuring:

Advanced Adaptive Indicators
Advanced Pattern Exploration
Neural Networks
And Much More ....
Find Out More Here

Bollinger Band Squeeze for Amibroker (AFL)

Rating:
4 / 5 (Votes 3)
Tags:
amibroker, bands

It is squeeze when the BBandWidth narrows.

Screenshots

Indicator / Formula

Copy & Paste Friendly
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

// BB MODEL AMIBROKER
/*
_SECTION_BEGIN("Bollinger Bands");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 300, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );
Color = ParamColor("Color", colorCycle );
Style = ParamStyle("Style");
Plot( BBandTop( P, Periods, Width ), "BBTop" + _PARAM_VALUES(), Color, Style ); 
Plot( BBandBot( P, Periods, Width ), "BBBot" + _PARAM_VALUES(), Color, Style ); 

PlotOHLC( bbt, bbt, bbb, bbb, "", ColorBlend( Color, GetChartBkColor(), 0.8 ), 
          styleNoLabel | styleCloud | styleNoRescale, Null, Null, Null, -1 ); // MODEL CLOUD
_SECTION_END();
*/

//-------------------------------------------------------------------------------------------------------------------------------------------------------------

// BBAB

_SECTION_BEGIN("Bollinger Bands");
P = ParamField("Price field",-1);
BBper = Param("BBper", 15, 2, 300, 1 );
StDevNr = Param("StDevNr", 2, 0, 10, 0.05 );
Color = ParamColor("Color", colorRed );
Style = ParamStyle("Style", styleDots + styleThick );

bbt = BBandTop( P, BBper, StDevNr ) ;
cupbbt = C>bbt ;
bbtup = bbt>Ref(bbt,-1) ;
bbtcol = IIf(bbtup, colorRed, colorPink) ;
bbb = BBandBot( P, BBper, StDevNr ) ;
bbbup = bbb>Ref(bbb,-1) ;
bbbcol = IIf(bbbup, colorRed, colorPink) ;
bbmid = (bbt + bbb)/2 ;
cupbbmid = C>bbmid ;
bbmidup = bbmid>Ref(bbmid,-1) ;
bbmidcol = IIf(bbmidup, colorBlue, colorAqua) ;

BBWidth = bbt - bbb ;

issqueeze = bbwidth<Ref(bbwidth,-1) ;
isexpand = bbwidth>Ref(bbwidth,-1) ;

bbupcond = cupbbmid AND bbmidup AND bbtup OR cupbbt ;
bbdncond = !cupbbmid ;

Plot( bbmid, "\nBBMid" + _PARAM_VALUES(), bbmidcol, Style ); 
Plot( bbt, "\nBBTop" + _PARAM_VALUES(), bbtcol, Style ); 
Plot( bbb, "\nBBBot" + _PARAM_VALUES(), bbbcol, Style ); 
_SECTION_END();

//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

//PRICE

_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%)Vol " +
            WriteVal( V, 1.0 ) + " {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 )) ));
Plot( C, "", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 

//barcolorc= IIf(C>O AND C>Ref(C,-1), colorBlue,
//           IIf(C<O AND C<Ref(C,-1), colorRed, colorTan)); //MODEL MODEL MODEL 3 CULORI
//SetBarFillColor( IIf(C>O AND C>Ref(C,-1), colorBrightGreen,
//                 IIf(C<O AND C<Ref(C,-1), colorOrange, colorTan))); //MODEL MODEL MODEL 3 CULORI
//Plot( C, "", barcolorc, styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
//Plot( C, "", barcolorc, styleBar+styleThick );
_SECTION_END();

//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

// BB SQUEEZE CLOUD

issqueezecol = IIf(issqueeze, colorGold, colorWhite) ;

PlotOHLC( bbt, bbt, bbb, bbb, "", issqueezecol, styleNoLabel | styleCloud | styleNoRescale, Null, Null, Null, -1 ); // MODEL CLOUD
          
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx


 

0 comments

Leave Comment

Please login here to leave a comment.

Back