커뮤니티
트레이드 스테이션에 있는 linearRegValue함수에 해당하는 YL가 있습니까?
2007-02-22 12:54:59
2016
글번호 11994
안녕하세요. 트레이드 스테이션에 있는
linerRegValue함수가 YL에도 있나요?
지금 변환해서 쓸려고 하는데...
어렵네요..도와주세요...
value = LinearRegValue( C , a, b); 는 어떻게 변환하면 될까요???
다음은 트레이드스테이션 도움말입니다.
The LinearRegValueFC function projects, based on the current regression line, the regression values for x number of bars out into the future or x number of bars back in the past.
This function uses a fast calculation method that uses more memory than the traditional method.
Function
LinearRegValueFC(PRICE, LEN, TARGETB)
Parameters
PRICE specifies which price of the asset to use
LEN indicates number of bars used in the calculation
TARGETB represents the number of bars into the future or back into the past
Returns
A numeric value containing the current value of the specified regression line at TARGETB.
Usage
Linear Regression is a concept also know as the "least squares method" or "best fit." Linear Regression attempts to fit a straight line between several data points in such a way that the distance between each data point and the line is minimized.
The equation of any line resembles the following:
y = mx + b
In the equation m refers to the slope of the regression line, b refers to the constant intercept of the y axis, x is the independent variable, and y is the dependent variable. This function returns the value y. The slope coefficient is the value returned by the function LinearRegSlope.
When the function is used in a study or strategy it requires three parameters from the user: PRICE, LEN and TARGETB.
The PRICE parameter tells the function which data points to use. For example, if you want the slope of Linear Regression line based on the Close, replace PRICE with Close. PRICE can also be replaced with a numeric series type input. You are not required to keep the parameter value equal to a bar attribute such as Close. For example, if you wanted to calculate the linear regression of the Relative Strength Index, you can replaced the PRICE parameter with RSI(Close,14).
The LEN parameter tells the function how many data points to consider in the regression. LEN can be hard coded with a number like 5 or be declared as a numeric simple input. The hard coded value or default value, if you choose to make LEN an input, can be any expression which uses simple mathematics like addition, subtraction, multiplication, or division. The value returned by the numeric simple type parameter cannot change on a bar by bar basis.
TARGETB represents the number of bars into the future or back into the past. If TARGETB is replaced by a positive number, the value returned by the LinearRegValueFC function will be for a bar in the past. If TARGETB is replaced by a negative number, the value returned by the LinearRegValueFC function will be for a bar in the future. For example, if you use a TARGETB of zero(0), the regression value returned would be for the current bar. However, if you use a -6, the value returned by the function would be the projected regression value for six bars out into the future. TARGETB can also be replaced with a numeric simple input.
{** ?1987, 1999 Omega Research, Inc. **}
답변 1
예스스탁 예스스탁 답변
2007-02-22 17:56:00
안녕하세요
예스스탁입니다.
식을 변환해 봤습니다.
input: Length(14),TgtBar(5);
var : oLRSlope(0),oLRAngle(0),oLRIntercept(0),oLRValueRaw(0);
var : SumXY(0),SumY(0),SumX(0),SumXSqr(0),OneSixth(0),Divisor(0),value1(0);
var : LinearRegFC(0);
Onesixth = 1/6;
if Length > 1 then{
SumX = Length*(Length-1)*0.5;
SumXSqr = Length*(Length-1)*(2*Length-1)*OneSixth;
Divisor = SumX^2-Length*SumXSqr;
SumXY = 0;
for Value1 = 0 to Length - 1{
SumXY = SumXY + Value1 * C[Value1] ;
}
SumY = accumn(C,Length);
oLRSlope = (Length*SumXY - SumX*SumY)/Divisor;
oLRAngle = ATan(oLRSlope);
oLRIntercept = (SumY - oLRSlope*SumX)/Length ;
oLRValueRaw = oLRIntercept + oLRSlope * (Length-1-TgtBar);
LinearRegFC = 1 ;
}
else
LinearRegFC = -1 ;
plot1(LinearRegFC);
참고하시기 바랍니다
즐거운 하루되세요
> CJ_coco 님이 쓴 글입니다.
> 제목 : 트레이드 스테이션에 있는 linearRegValue함수에 해당하는 YL가 있습니까?
> 안녕하세요. 트레이드 스테이션에 있는
linerRegValue함수가 YL에도 있나요?
지금 변환해서 쓸려고 하는데...
어렵네요..도와주세요...
value = LinearRegValue( C , a, b); 는 어떻게 변환하면 될까요???
다음은 트레이드스테이션 도움말입니다.
The LinearRegValueFC function projects, based on the current regression line, the regression values for x number of bars out into the future or x number of bars back in the past.
This function uses a fast calculation method that uses more memory than the traditional method.
Function
LinearRegValueFC(PRICE, LEN, TARGETB)
Parameters
PRICE specifies which price of the asset to use
LEN indicates number of bars used in the calculation
TARGETB represents the number of bars into the future or back into the past
Returns
A numeric value containing the current value of the specified regression line at TARGETB.
Usage
Linear Regression is a concept also know as the "least squares method" or "best fit." Linear Regression attempts to fit a straight line between several data points in such a way that the distance between each data point and the line is minimized.
The equation of any line resembles the following:
y = mx + b
In the equation m refers to the slope of the regression line, b refers to the constant intercept of the y axis, x is the independent variable, and y is the dependent variable. This function returns the value y. The slope coefficient is the value returned by the function LinearRegSlope.
When the function is used in a study or strategy it requires three parameters from the user: PRICE, LEN and TARGETB.
The PRICE parameter tells the function which data points to use. For example, if you want the slope of Linear Regression line based on the Close, replace PRICE with Close. PRICE can also be replaced with a numeric series type input. You are not required to keep the parameter value equal to a bar attribute such as Close. For example, if you wanted to calculate the linear regression of the Relative Strength Index, you can replaced the PRICE parameter with RSI(Close,14).
The LEN parameter tells the function how many data points to consider in the regression. LEN can be hard coded with a number like 5 or be declared as a numeric simple input. The hard coded value or default value, if you choose to make LEN an input, can be any expression which uses simple mathematics like addition, subtraction, multiplication, or division. The value returned by the numeric simple type parameter cannot change on a bar by bar basis.
TARGETB represents the number of bars into the future or back into the past. If TARGETB is replaced by a positive number, the value returned by the LinearRegValueFC function will be for a bar in the past. If TARGETB is replaced by a negative number, the value returned by the LinearRegValueFC function will be for a bar in the future. For example, if you use a TARGETB of zero(0), the regression value returned would be for the current bar. However, if you use a -6, the value returned by the function would be the projected regression value for six bars out into the future. TARGETB can also be replaced with a numeric simple input.
{** ?1987, 1999 Omega Research, Inc. **}
다음글
이전글