xel

Standard Error Composite Bands

Category: Indicators By: xel Created: March 23, 2016, 11:52 AM
March 23, 2016, 11:52 AM
Indicators
3 Comments
Standard Error Composite Bands

STANDARD ERROR COMPOSITE BANDS
Transcript Code by @XeL_arjona
Ver. 1.00.a

Original implementation idea of bands by: Traders issue: Stocks & Commodities V. 14:9 (375-379):
Standard Error Bands by Jon Andersen


Introduction and Implementation:

STANDARD ERROR BANDS are quite different than Bollinger’s.  First, they are bands constructed around a linear regression curve.  Second, the bands are based on standard errors with a factor multiplier above and below this regression line.  The error bands measure the STANDARD ERROR OF THE ESTIMATE around the linear regression line. Therefore, as a price series follows the course of the regression line the bands will narrow, showing little error in the estimate. As the market gets noisy and random, the error will be greater resulting in wider bands.

An Additional “alpha-beta (y-y’) algorithm” of Standard Error is implemented as additional -Resistance/Support- on bands. The algorithm was originally made for TradingView’s pine version by user @glaz.

Links for further reference:
Standard Error Bands by Jon Andersen Implementation
What is a STANDARD ERROR ? (Wikipedia)
Resumed explanation of what is an STANDARD ERROR OF THE ESTIMATE.


The CODE:

P = 21,      SDEG = 1,      MF=2

// Standard Error of the Estimate (Composite Bands)
AR = close
N = barindex
LR = Average[SDEG](linearregression[P](AR))

// BETA
bv1 = summation[P](N*AR) - (P*Average[P](N)*Average[P](AR))
bv2 = summation[P](square(N)) - (P*square(Average[P](N)))
CalcB = bv1/bv2
// ALPHA
CalcA = Average[P](AR) - (CalcB*Average[P](N))

// STANDARD ERROR OF THE ESTIMATE
sev1 = Summation[P](square(AR)) - (CalcA*Summation[P](AR)) - (CalcB*Summation[P](N*AR))
sev2 = Summation[P](square(LR-AR))
sev3 = P - 2
SEnarrow = sqrt(sev1/sev3)
SEwide   = sqrt(sev2/sev3)

// BANDS
NarrowUB = LR + (SEnarrow*MF)
NarrowBB = LR - (SEnarrow*MF)
WideUB   = LR + (SEwide*MF)
WideBB   = LR - (SEwide*MF)

// OUTPUT
RETURN LR AS "Linear Regression Curve", NarrowUB AS "StandardError Narrow UpperBand", NarrowBB AS "StandardError Narrow BottmBand", WideUB AS "StandardError Wide UpperBand", WideBB AS "StandardError Wide BottomBand"

Download
Filename: Composite-Bands.itf
Downloads: 166
xel
xel Average
Mexico, US Stock Momentum Trader.
Author’s Profile

Comments

Saud
10 years ago
#

Thanks for this one, I was hoping PRT would add this.

xel
xel
11 years ago
#

Thanks a lot Nicolas!

This is a very helpful indicator to catch "Fastest Moves" if you use it alongside with Bollinger's for the same RollingBack window period.

Can't attach images, but you can as an example of what Im saying, apply both Bollinger alongside with StandardErrorBands to any mayor US Index weekly with a 52 looking back period to see what I mean!   ;)

Nicolas
11 years ago
#

Very nice and qualitative contribution to the Library, well done xel! I'm looking forward for any other post by you.

ProRealCode ProRealCode
Loading...