Код: Выделить всё
function Initialize()
{
IndicatorName = "SMA_III";
PriceStudy = true ;
AddInput("Input", Inputs.Price);
AddParameter("Period", 1);
AddGlobalVariable("D", Types.Double, 0.0);
AddSeries("S", DrawAs.Custom, Color.Yellow);
}
function Evaluate()
{
if ( CurrentIndex < Period )
{
D = D + Input[0];
S = D / (CurrentIndex + 1);
}
else
{
D = D + Input[0] - Input[(int)(-Period)] ;
S = D / Period;
}
if ( S[0] >= MY.индикатор.GetValue("L", 1))
S.DrawLine(Color.Green, Line.DashSmall, 3);
if ( S[0] <= MY.индикатор.GetValue("H", 1))
S.DrawLine(Color.Red, Line.DashSmall, 3);
}