커뮤니티
파라볼릭 오류 수정해주세요
2013-04-26 09:26:47
542
글번호 62520
파라볼릭 수식에 오류가 있습니다..
예스트레이더에서 프로그램에 있는 지표식을 이용해서
테스트 결과 파라볼릭을찍으면 다음봉에서 턴이 발생해야 하나.
붙임 이미지 와 같이 위쪽으로 턴이 발생해야 하나
아래쪽을 찍었는데요 턴이 발생하지 않는 오류가 있는거 같습니다..
수식 수정부탁드립니다.
var : sar(0,Data1);
Input : AF(0.033), AFMAX(0.33);
var1 = SAR(af,AFmax);
//----------------------------------
/* Description : Parabolic (S)top (A)nd (R)eversal
*
* Provided By : YesStock Inc. (c) Copyright 2006
* E-Mail : webmaster@yesstock.com
*/
Var : Direction(0), SAR_Value(Close), AF_Value(.033), HighValue(High), LowValue(Low), EP(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;
}
}
Sar = SAR_Value;
}
else
{
if SAR_Value != 0 && EP == 0 then
{
if Direction == 1 then
{
EP = HighValue;
AF_Value = AF;
SAR_Value = SAR_Value[1] + AF_Value * (EP - SAR_Value[1]);
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[1] + AF_Value * (EP - SAR_Value[1]);
if Low < LowValue then
{
LowValue = Low;
AF_Value = AF_Value + AF;
if AF_Value >= AFMAX then AF_Value = AFMAX;
}
}
Sar = 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;
Sar = SAR_Value;
}
}
if Direction == -1 then
{
if Close > Close[1] then
{
Direction = 1;
SAR_Value = LowValue;
Sar = SAR_Value;
}
}
}
LowValue = min(Low, LowValue);
HighValue = max(High, HighValue);
}
}
if HighValue >H Then
Plot1(var1, "SAR",BLUE);
Else
Plot1(var1, "SAR",RED);
If crossup (high, Var1) Then
plot2(Var1[1],"2",Red);
If CrossDown(low, Var1) Then
plot3(Var1[1],"3",Red);
- 1. 파라볼릭 오류캡쳐 4.26.PNG (0.01 MB)
답변 1
예스스탁 예스스탁 답변
2013-04-29 10:55:36
안녕하세요
예스스탁입니다.
다른 방법으로 파라볼릭 작성해서 올려드립니다.
사용자함수로 작성하셔서 사용하시기 바랍니다.
사용자함수명 : Parabolic
내용
Input:af(Numeric),maxAF(Numeric);
Var:오늘(0),극대(0),극저(0),가속(0),내일(0),추세(0),상승(1),하락(-1);
if Index == 0 then {
극대 = H; 극저 = L;
}
if 오늘[1] == 0 then {
if 추세[1] == 0 then {
if C[1] < C then 추세 = 상승;
if C[1] > C then 추세 = 하락;
}
if 추세[1] == 상승 and C[1] > C then {
추세 = 하락;
오늘 = 극대[1];
가속 = af;
}
if 추세[1] == 하락 and C[1] < C then {
추세 = 상승;
오늘 = 극저[1];
가속 = af;
}
극저 = min(L,극저);
극대 = max(H,극대);
}
if 오늘[1] > 0 then {
if 추세[1] == 상승 then {
if L > 내일[1] then {
오늘 = 내일[1];
극저 = 0;
if H > 극대[1] then {
극대 = H;
가속 = min(maxAF,가속+af);
}
}
else {
추세 = 하락;
오늘 = 극대[1];
극대 = 0;
극저 = L;
가속 = af;
}
}
if 추세[1] == 하락 then {
if H < 내일[1] then {
오늘 = 내일[1];
극대 = 0;
if L < 극저[1] then {
극저 = L;
가속 = min(maxAF,가속+af);
}
}
else {
추세 = 상승;
오늘 = 극저[1];
극저 = 0;
극대 = H;
가속 = af;
}
}
}
내일 = (max(극대,극저) - 오늘) * 가속 + 오늘;
Parabolic = 오늘[0];
즐거운 하루되세요
> HI_cbk4610 님이 쓴 글입니다.
> 제목 : 파라볼릭 오류 수정해주세요
> 파라볼릭 수식에 오류가 있습니다..
예스트레이더에서 프로그램에 있는 지표식을 이용해서
테스트 결과 파라볼릭을찍으면 다음봉에서 턴이 발생해야 하나.
붙임 이미지 와 같이 위쪽으로 턴이 발생해야 하나
아래쪽을 찍었는데요 턴이 발생하지 않는 오류가 있는거 같습니다..
수식 수정부탁드립니다.
var : sar(0,Data1);
Input : AF(0.033), AFMAX(0.33);
var1 = SAR(af,AFmax);
//----------------------------------
/* Description : Parabolic (S)top (A)nd (R)eversal
*
* Provided By : YesStock Inc. (c) Copyright 2006
* E-Mail : webmaster@yesstock.com
*/
Var : Direction(0), SAR_Value(Close), AF_Value(.033), HighValue(High), LowValue(Low), EP(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;
}
}
Sar = SAR_Value;
}
else
{
if SAR_Value != 0 && EP == 0 then
{
if Direction == 1 then
{
EP = HighValue;
AF_Value = AF;
SAR_Value = SAR_Value[1] + AF_Value * (EP - SAR_Value[1]);
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[1] + AF_Value * (EP - SAR_Value[1]);
if Low < LowValue then
{
LowValue = Low;
AF_Value = AF_Value + AF;
if AF_Value >= AFMAX then AF_Value = AFMAX;
}
}
Sar = 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;
Sar = SAR_Value;
}
}
if Direction == -1 then
{
if Close > Close[1] then
{
Direction = 1;
SAR_Value = LowValue;
Sar = SAR_Value;
}
}
}
LowValue = min(Low, LowValue);
HighValue = max(High, HighValue);
}
}
if HighValue >H Then
Plot1(var1, "SAR",BLUE);
Else
Plot1(var1, "SAR",RED);
If crossup (high, Var1) Then
plot2(Var1[1],"2",Red);
If CrossDown(low, Var1) Then
plot3(Var1[1],"3",Red);
다음글
이전글