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

BollingerLine indicator for Amibroker (AFL)
Dryden
almost 13 years ago
Amibroker (AFL)

Rating:
3 / 5 (Votes 3)
Tags:
oscillator, amibroker, optimize

BollingerLine indicator between bollingerbands.
Good to determine early changes.

Screenshots

Similar Indicators / Formulas

Stochastic (Generic)
Submitted by walid about 14 years ago
Double SMI (stochastic Momentum Index)
Submitted by ecredic about 13 years ago
4 MACD for optimisation
Submitted by DOMINATOR over 14 years ago
MACD
Submitted by sal about 14 years ago
Stochastic (Generic) for Amibroker
Submitted by 123flex456 over 13 years ago
Trend Trigger Factor
Submitted by M4RC68 over 14 years ago

Indicator / Formula

Copy & Paste Friendly
_SECTION_BEGIN("_BollingerLine Indicator");

GraphXSpace=7;

periods = Optimize("periods ",Param("periods ",20,1,48,1),1,48,1);
width = Optimize("width ",Param("width ",2,0.1,10,0.1),2,2,0.1);

C1 = C - BBandBot( Close, periods, width) ;
C2 = BBandTop (Close,periods,width) - BBandBot( Close, periods, width);

R = (C1 / C2)*100;
RS = (AMA( C1,  0.5 ) / AMA( C2,  0.5 ))*100; //smooth

uptrend = r > Ref(r,-1);
downtrend = r < Ref(r,-1);

uptrendS = rs > Ref(rs,-1);
downtrendS = rs < Ref(rs,-1);

BS = ParamToggle("smooth","No|Yes",1);
BN = ParamToggle("normal","No|Yes",0);

if (BS) Plot( RS , " smooth ", IIf(( uptrendS ), colorGreen, colorRed ));
if (BS) Plot ( 2, "", IIf( uptrendS , colorGreen, IIf( downtrendS , colorRed, colorPink )), styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );

if (BN) Plot( R , " normal ", IIf(( uptrend ), colorGreen, colorRed ));
if (BN) Plot ( 4, "", IIf( uptrend, colorGreen, IIf( downtrend, colorRed, colorPink )), styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );

_SECTION_END();

_SECTION_BEGIN("Bollinger Bands");
P = rs ;//ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 100, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );
Color = ParamColor("Color", colorLightGrey );
Style = ParamStyle("Style", styleLine | styleNoLabel ) | styleNoLabel;
bbt = BBandTop( P, Periods, Width );
bbb = BBandBot( P, Periods, Width );
Plot( bbt , "BBTop" + _PARAM_VALUES(), colorBlack, Style ); 
Plot( bbb , "BBBot" + _PARAM_VALUES(), colorBlack, Style ); 
PlotOHLC( bbt, bbt, bbb, bbb, "", ColorBlend( Color, colorWhite, 0.9 ), styleNoLabel | styleCloud | styleNoRescale, Null, Null, Null, -1 );
_SECTION_END();

bbm = (bbb + bbt) / 2; // middle bollingerbands
f= Optimize("colored bandsize factor",Param("colored bandsize factor",7,1,21,1),1,21,1);

bbmf = (bbm / 100) * f;

bwup = (bbt - bbmf);
bwlo = (bbb + bbmf);

PlotOHLC (bbb ,bbb ,bwlo ,bwlo ,"lowercloud",colorPink,styleCloud,0,0,0);
PlotOHLC (bbt ,bbt ,bwup ,bwup ,"uppercloud",colorBrightGreen,styleCloud,0,0,0);
Plot( bbm , "BBMiddle" + _PARAM_VALUES(), colorPink, styleDashed );

b1= C > O AND L>Ref(L,-1) AND (Ref(L,-1) > Ref(L,-2) OR (C>Ref(O,-1) AND O<Ref(H,-1)));
b2= rs > Ref(rs,-1) AND rs < bwup AND Ref(rs,-1) < Ref(bwup,-1);

s1= C < O AND H<Ref(H,-1) AND (Ref(H,-1)< Ref(H,-2) OR (C<Ref(O,-1) AND O>Ref(L,-1)));
s2= rs < Ref(rs,-1) AND rs > bwlo AND Ref(rs,-1) > Ref(bwlo,-1);

Buy = b1 AND b2;
Sell = s1 AND s2;

//Plot( 5, /* defines the height of the ribbon in percent of pane width */"ribbon",
//IIf( Buy , colorLightBlue, IIf( Sell , colorOrange, colorLavender )), /* choose color */
//styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );

3 comments

1. szgolyas

error in line 52

2. Dryden

szgolyas, use latest amibroker version

3. sujeetnd10

Hey Dryden, thank you very much for this AFL,
I was using this strategy, however your indicator added more edge to it.

Thank you again

Leave Comment

Please login here to leave a comment.

Back