xel_arjona

Standard Error of the Estimate -Composite Bands-

Standard Error of the Estimate - Code and adaptation by @glaz & @XeL_arjona
Ver. 2.00.a


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


This code is a former update to previous "Standard Error Bands" that was wrongly applied given that previous version in reality use the Standard Error OF THE MEAN, not THE ESTIMATE as it should be used by Jon Andersen original idea and corrected in this version.

As always I am very Thankfully with the support at the Pine Script Editor chat room, with special mention to user @glaz in order to help me adequate the alpha-beta (y-y') algorithm, as well to give him full credit to implement the "wide" version of the former bands.

For a quick and publicly open explanation of this truly statistical (regression analysis) indicator, you can refer at Here!

Extract from the former URL:
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 two standard errors 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.

สคริปต์โอเพนซอร์ซ

ด้วยจิตวิญญาณของ TradingView อย่างแท้จริง ผู้เขียนสคริปต์นี้ได้เผยแพร่เป็นโอเพนซอร์ส เพื่อให้ผู้ค้าสามารถเข้าใจและตรวจสอบได้ ไชโยให้กับผู้เขียน! คุณสามารถใช้ได้ฟรี แต่การใช้รหัสนี้ซ้ำในสิ่งพิมพ์อยู่ภายใต้กฎระเบียบการใช้งาน คุณสามารถตั้งเป็นรายการโปรดเพื่อใช้บนชาร์ตได้

คำจำกัดสิทธิ์ความรับผิดชอบ

ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมที่ เงื่อนไขการใช้บริการ

ต้องการที่จะใช้สคริปต์นี้บนชาร์ตใช่ไหม?
//@version=2
study("Standard Error of the Estimate -Composite Bands-", shorttitle="SEE", overlay=true)
p = input(title="Rolling Lookback Window:", defval=21)
sdeg = input(title="Smoothing Factor:", defval=3)

// Standard Error of the Estimate Algorithm's
beta(array,per) =>
    val1 = sum(n*array,per)-(per*sma(n,per)*sma(array,per))
    val2 = sum(pow(n,2),per)-(per*pow(sma(n,per),2))
    calcB = val1/val2
alpha(array,per) =>
    calcA = sma(array,per)-(beta(array,per)*sma(n,per))
see(array,per,mult,dir,type) =>
    lr = linreg(array,per,0)
    val1 = (sum(pow(array,2),per))-((alpha(array,per)*sum(array,per)))-((beta(array,per)*sum(n*array,per)))
    val2 = per - 2
    narrow = sqrt(val1/val2)
    est = sum(pow(lr-array,2),per) / (per - 2 )
    wide = sqrt(est)
    d = dir ? 1 : -1
    band = type ? narrow : wide
    seb = lr + d * mult * band

// Plotting
UWB = plot(sma(see(close,p,2,true,false),sdeg),color=red,transp=90)
UNB = plot(sma(see(close,p,2,true,true),sdeg),color=red,transp=90)
middle = plot(sma(linreg(close,p,0),sdeg),color=red,style=line,transp=0)
BNB = plot(sma(see(close,p,2,false,true),sdeg),color=red,transp=90)
BWB = plot(sma(see(close,p,2,false,false),sdeg),color=red,transp=90)
fill(UWB,BWB,transp=95,title="WSEE",color=red)
fill(UNB,BNB,transp=90,title="NSEE",color=red)

ไอเดียที่เกี่ยวข้อง