|
|||||||||||||||||||
| Special offer: buy MetaStock (try for free) | Reuters QuoteCenter Real-Time Data (get a free month) | EOD Data |
|
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)); Next, build the standard error bands indicator. The "length" value specifies the period of the linear regression line; the default is 21. The SDeg value specifies the smoothing factor that is used to smooth the linear regression and standard error bands; the default is 3. 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; The indicator for the related %A standard error bands is built using the code below. It's best plotted with the bar type set to "histogram." 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; This code is available at both the Omega Research Forum on America On-Line as well as at Omega's Web site. -- Gaston Sanchez, Omega Research Internet: http://www.omegaresearch.com Code:
all formulas for TradeStation all formulas
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| However we try to maintain hiqhest possible level of service - most formulas, oscillators, indicators and systems are submitted by anonymous users. Therefore S4T™ does not take any responsibility for it's quality. If you use any of this information, use it at your own risk. You are responsible for your own trading decisions. Be sure to verify that any information you see on these pages is correct, and is applicable to your particular trade. In no case will S4T™ be responsible for your trading gains or losses. |
|
|