STANDARD ERROR BANDS

STANDARD ERROR BANDS

Type: User Function, Name: calcB

Inputs: Length(Numeric);
Vars: X(0);

X = BarNumber;

Value1 = Summation(X * Close, Length) — (Length * Average(X, Length) *Average(Close, Length));
Value2 = Summation(Square(X), Length) — (Length * Square(Average(X, Length)));

calcB = Value1/Value2;

Type: User Function, Name: calcA

Inputs: Length(Numeric);
Vars: X(0);

X = BarNumber;

calcA = Average(Close, Length) — (calcB(Length) * Average(X, Length));

Type: Indicator, Name: Std Error Bands Smooth

Inputs: Length(21), SDeg(3);
Vars: LinRegY(0), X(0), StdErr(0), LinRegS(0), SErr(0);

LinRegY = LinearRegValue(Close, Length, 0);
X = CurrentBar;

IF CurrentBar > Length then Begin
Value1 = (Summation(Square(Close), Length)) — ((calcA(Length) *
Summation(Close, Length))) — ((calcB(Length) *
Summation(X * Close, Length)));
Value2 = Length — 2;
StdErr = SquareRoot(Value1 / Value2);
LinRegS = Average(LinRegY, SDeg);
SErr = 2 * Average(StdErr, SDeg);

Plot1(LinRegS, «LinRegS»);
Plot2(LinRegS + SErr, «+StdErrS»);
Plot3(LinRegS — SErr, «-StdErrS»);
End;

STANDARD ERROR BANDS

Type: Indicator, Name: Standard Error Bands %A

Inputs: Length(21), SDeg(3);
Vars: LinRegY(0), X(0), StdErr(0), LinRegS(0), SErr(0), PcntA(0);

LinRegY = LinearRegValue(Close, Length, 0);
X = CurrentBar;

IF CurrentBar > Length then Begin
Value1 = (Summation(Square(Close), Length)) — ((calcA(Length) *
Summation(Close, Length))) — ((calcB(Length) *
Summation(X * Close, Length)));
Value2 = Length — 2;
StdErr = SquareRoot(Value1 / Value2);
LinRegS = Average(LinRegY, SDeg);
SErr = 2 * Average(StdErr, SDeg);
PcntA = (Close — (LinRegS-SErr)) / ((LinRegS+SErr)-(LinRegS-SErr)) * 100;

Plot1(PcntA, «%A»);
End;

Подписаться
Уведомить о
0 комментариев
Межтекстовые Отзывы
Посмотреть все комментарии