included bollinger-bands
_SECTION_BEGIN("_bollinger modification");
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),0.1,10,0.1);
C1 = C - BBandBot( Close, periods, width) ;
C2 = BBandTop (Close,periods,width) - BBandBot( Close, periods, width);
R = C1 / C2;
RS = (AMA( C1, 0.5 ) / AMA( C2, 0.5 )); //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 ( 1, "", IIf( uptrendS , colorGreen, IIf( downtrendS , colorRed, colorLavender )), styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );
if (BN) Plot( R , " normal ", IIf(( uptrend ), colorGreen, colorRed ));
if (BN) Plot ( 2, "", IIf( uptrend, colorGreen, IIf( downtrend, colorRed, colorLavender )), styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );
_SECTION_END();
_SECTION_BEGIN("Bollinger Bands");
P = 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;
Plot( bbt = BBandTop( P, Periods, Width ), "BBTop" + _PARAM_VALUES(), Color, Style );
Plot( bbb = BBandBot( P, Periods, Width ), "BBBot" + _PARAM_VALUES(), Color, Style );
PlotOHLC( bbt, bbt, bbb, bbb, "", ColorBlend( Color, colorWhite, 0.9 ), styleNoLabel | styleCloud | styleNoRescale, Null, Null, Null, -1 );
_SECTION_END();
and a picture