Набор стандартных каналов
По аналогии с набором скользящих средних удобно иметь такой же для всевозможных каналов. Иллюстрация для стандартных каналов, включенных в поставку Амиброкер:
Array = ParamField("Цена для расчета");
Periods = ParamOptimize("Periods", 15, 2, 300, 1 );
Width = ParamOptimize("Width", 2, 0, 10, 0.05 );
Color = ParamColor("Цвет канала",colorBlue);
Style = ParamStyle("Стиль канала",styleline|styleNoRescale,styleLine|styleNoLine|styleThick|styleDots|styleDashed|StyleNoLabel|StyleNoRescale);
switch(ParamList("Тип канала","Bollinger,Keltner,Percent"))
{ case "Bollinger" :
Up = BBandTop( Array, Periods, Width );
Down = BBandBot(Array, Periods, Width );
Plot(Up, "BBTop" + _PARAM_VALUES(), Color, Style );
Plot(Down, "BBBot" + _PARAM_VALUES(), Color, Style );
break;
case "Keltner" :
CenterLine = MA(Array, Periods );
Up = CenterLine + Width * ATR( Periods );
Down = CenterLine - Width * ATR( Periods );
Plot(Up, "KBTop" + _PARAM_VALUES(), Color, Style );
Plot(Down, "KBBot" + _PARAM_VALUES(), Color, Style );
break;
case "Percent" :
CenterLine = MA(Array, Periods );
Up = (1 + Width * 0.01) * CenterLine;
Down = (1 - Width * 0.01) * CenterLine;
Plot(Up, "%EnvTop" + _PARAM_VALUES(), Color, Style );
Plot(Down, "%EnvBot" + _PARAM_VALUES(), Color, Style );
}