hi,
I want to use different default values for Bollinger Bands based on TimeFrame.
Ex: in Daily TF, use 20,125,1.5
in Weekly TF, use 24,20,2
Below is the code i was trying to use, but setting Timeframe to Daily, Weekly, always picks the default assignments (24,20,2) in inWeekly branch, in code below. How can i change the param values based on timeframe?
_SECTION_BEGIN( "BB Squeeze" );
//BBMedian = MA(C,20);
if( inDaily )
{
defaultCount = 20;
defaultPeriod = 125;
defaultWidth = 1.5;
}
if( inWeekly )
{
defaultCount = 24;
defaultPeriod = 20;
defaultWidth = 2;
}
SDCount = Param( "SDCount", defaultCount, 1, 300, 1 );
Periods = Param( "Periods", defaultPeriod, 1, 300, 1 );
Width = Param( "Width", defaultWidth, 0, 10, 0.05 );
P = StDev( C, SDCount );
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 );
Plot( P, "StdDev", colorBlack );
_SECTION_END();