Help requested with Bollinger Bands Optimization
Please help me learn optimization and on a bollinger band.
This is my price chart, black background, yellow bars (not candlesticks), dotted red bollinger band. I would like to optimize the bollingerband with the variables below.
Please help with code change so that all the variables of the bollinger band can be optimized for a given dataset. Also, once the optimized values are set in variables, the bollingerband will be charted with new values and same can be used in trading strategy.
valBollingerBandsDefaultLookbackPeriod = 15 ;
valBollingerBandsMaxLookback = 20 ;
valBollingerBandsMinLookback = 10 ;
valBollingerBandsLookbackStep = 1 ;
valBollingerBandsDefaultStdVariation = 2 ;
valBollingerBandsMaxStdVariation = 3 ;
valBollingerBandsMinStdVariation = 1 ;
valBollingerBandsStdVariationStep = .05 ;
_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("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 );
_SECTION_END();