Standard Error Bands

Here you can post and download custom indicators. PLEASE: Do not start topics unless you are posting your own indicator, they will be moved to appropriate section even if you do.

Moderator: admin

Standard Error Bands

Postby Apprentice » Sun Apr 12, 2015 5:04 am

Standard Error Bands.png

Smoothed Linear Regression Line: Generally a 21-period linear regression curve that is smoothed by a 3-period simple moving average
Upper Standard Error Band: The linear regression line plus 2 standard errors.
Lower Standard Error Band: The linear regression line minus 2 standard errors.
Introduced by John Andersen in a September 1996 'Stock and Commodities' magazine artikle.
Standard Error Bands.lua
(4.87 KiB) Downloaded 414 times
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 18974
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Standard Error Bands

Postby Alexander.Gettinger » Fri May 22, 2015 9:55 am

MQL4 version of Standard Error Bands indicator: viewtopic.php?f=38&t=62244.
Alexander.Gettinger
FXCodeBase: Confirmed User
 
Posts: 3238
Joined: Wed Mar 31, 2010 9:40 pm
Location: Russia, Omsk

Re: Standard Error Bands

Postby Apprentice » Tue May 24, 2016 2:15 am

Minor Update.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 18974
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Standard Error Bands

Postby xel_arjona » Tue Jun 07, 2016 4:39 pm

Just for the record, Bands are badly calculated.

Here's the implementation I made at TradingView's Pine if you like to re-code it to LUA:

https://www.tradingview.com/script/qQjavJxT-Standard-Error-of-the-Estimate-Composite-Bands/

Basically you need to define 2 functions prior to calculate error which are Alpha and Beta, then define the Standard Error Estimate from the Linear Regression Curve (I like to use TSF)

Code: Select all
beta(array,periods) where
    n     = barindex
    val1 = sum(n*array,periods)-(periods*sma(n,periods)*sma(array,periods))
    val2 = sum(pow(n,2),periods)-(periods*pow(sma(n,periods),2))
    calcB = val1/val2

alpha(array,periods) =>
    n       = barindex
    calcA = sma(array,periods)-(beta(array,periods)*sma(n,periods))

see(array,periods)  //  This function must supplant StdDev for band creation with mult factor
    lr = linearregression(array,periods)  // Can be supplanted with TSF
    val1 = (sum(pow(array,2),periods))-((alpha(array,periods)*sum(array,periods)))-((beta(array,periods)*sum(n*array,periods)))
    val2 = periods - 2
    eest = sqrt(val1/val2)


Hope it helps! ;)
xel_arjona
 
Posts: 1
Joined: Tue Jun 07, 2016 4:24 pm

Re: Standard Error Bands

Postby Apprentice » Fri Jun 10, 2016 3:03 am

Your request is added to the development list.
Bugzilla Bug 3539
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 18974
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Standard Error Bands

Postby Apprentice » Mon Aug 28, 2017 9:30 am

The indicator was revised and updated.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 18974
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Standard Error Bands

Postby Alexander.Gettinger » Fri Dec 15, 2017 4:57 pm

xel_arjona wrote:Just for the record, Bands are badly calculated.

Here's the implementation I made at TradingView's Pine if you like to re-code it to LUA:

https://www.tradingview.com/script/qQjavJxT-Standard-Error-of-the-Estimate-Composite-Bands/

Basically you need to define 2 functions prior to calculate error which are Alpha and Beta, then define the Standard Error Estimate from the Linear Regression Curve (I like to use TSF)



Please, try this version of the indicator:
Standard_Error_Band2.PNG

Standard Error Bands2.lua
(7 KiB) Downloaded 90 times
Alexander.Gettinger
FXCodeBase: Confirmed User
 
Posts: 3238
Joined: Wed Mar 31, 2010 9:40 pm
Location: Russia, Omsk

Re: Standard Error Bands

Postby Apprentice » Wed Jun 20, 2018 6:08 am

The Indicator was revised and updated.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 18974
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia


Return to Custom Indicators

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 7 guests