커뮤니티
사용자함수에....
2015-04-14 13:47:17
137
글번호 85026
사용자함수에 있는 Sar을 지표식으로 변환해주세요^^
답변 1
예스스탁 예스스탁 답변
2015-04-14 16:02:41
안녕하세요
예스스탁입니다.
sar는 파라볼릭함수입니다.
지표식중 파라볼릭이 해당 함수를 이용해 지표를 그리는 식입니다.
함수를 안쓰고 풀어서 지표식 작성하면 아래와 같습니다.
/* Description : Parabolic (S)top (A)nd (R)eversal
*
* Provided By : YesStock Inc. (c) Copyright 2006
* E-Mail : webmaster@yesstock.com
*/
Input : AF(0.02), AFMAX(0.2);
Var : Direction(0), SAR_Value(Close), AF_Value(.02), HighValue(High), LowValue(Low), EP(0),sarv(0);
if EP != 0 Then
{
if Direction == 1 then
{
EP = HighValue;
SAR_Value = SAR_Value + AF_Value * (EP - SAR_Value);
if High > HighValue then
{
HighValue = High;
AF_Value = AF_Value + AF;
if AF_Value >= AFMAX then AF_Value = AFMAX;
}
if Low < SAR_Value then
{
Direction = -1;
SAR_Value = EP;
AF_Value = 0;
EP = 0;
LowValue = low;
}
}
else
{
EP = LowValue;
SAR_Value = SAR_Value + AF_Value * (EP - SAR_Value);
if Low < LowValue then
{
LowValue = Low;
AF_Value = AF_Value + Af;
if AF_Value >= AFMAX then AF_Value = AFMAX;
}
if High > SAR_Value then
{
Direction = 1;
SAR_Value = EP;
AF_Value = 0;
EP = 0;
HighValue = High;
}
}
Sarv = SAR_Value;
}
else
{
if SAR_Value != 0 && EP == 0 then
{
if Direction == 1 then
{
EP = HighValue;
AF_Value = AF;
SAR_Value = SAR_Value + AF_Value * (EP - SAR_Value);
if High > HighValue then
{
HighValue = High;
AF_Value = AF_Value + AF;
if AF_Value >= AFMAX then AF_Value = AFMAX;
}
}
else
{
EP = LowValue;
AF_Value = Af;
SAR_Value = SAR_Value + AF_Value * (EP - SAR_Value);
if Low < LowValue then
{
LowValue = Low;
AF_Value = AF_Value + AF;
if AF_Value >= AFMAX then AF_Value = AFMAX;
}
}
Sarv = SAR_Value;
}
else
{
if Direction == 0 then
{
if Close > Close[1] then Direction = 1;
else
if Close < Close[1] then Direction = -1;
}
else
{
if Direction == 1 then
{
if Close < Close[1] then
{
Direction = -1;
SAR_Value = HighValue;
Sarv = SAR_Value;
}
}
if Direction == -1 then
{
if Close > Close[1] then
{
Direction = 1;
SAR_Value = LowValue;
sarv= SAR_Value;
}
}
}
LowValue = min(Low, LowValue);
HighValue = max(High, HighValue);
}
}
plot1(sarv);
즐거운 하루되세요
> 팽구 님이 쓴 글입니다.
> 제목 : 사용자함수에....
> 사용자함수에 있는 Sar을 지표식으로 변환해주세요^^