커뮤니티
문의 드립니다.
2012-02-02 08:41:21
382
글번호 47226
아래는 파라볼릭 갭보정식입니다.
시스템식으로 사용해보니 잘 안되는군요.
sarV = Sar(af,AFMAX);
여기서 막히네요.
매수매도식 좀 부탁드리겠습니다.
Input : AF(0.02), AFMAX(0.2);
Var : Direction(0), SAR_Value(Close), AF_Value(.02), HighValue(h), LowValue(l), EP(0);
var : gap(0),sumgap(0),GO(0),GH(0),GL(0),GC(0),sarv(0);
if date!=date[1] then { // 날짜가 변경되는 봉에서(분봉에서 첫번째 봉)
gap = Open-Close[1]; // 일간갭
sumGap = sumGap+gap; // 일간갭 누적
}
GO = O - sumGap;// 갭보정 시가
GH = H - sumGap;// 갭보정 고가
GL = L - sumGap;// 갭보정 저가
GC = C - sumGap; // 갭보정 종가
if EP != 0 Then
{
if Direction == 1 then
{
EP = HighValue;
SAR_Value = SAR_Value + AF_Value * (EP - SAR_Value);
if gh > HighValue then
{
HighValue = gh;
AF_Value = AF_Value + AF;
if AF_Value >= AFMAX then AF_Value = AFMAX;
}
if gl < SAR_Value then
{
Direction = -1;
SAR_Value = EP;
AF_Value = 0;
EP = 0;
LowValue = gl;
}
}
else
{
EP = LowValue;
SAR_Value = SAR_Value + AF_Value * (EP - SAR_Value);
if gl < LowValue then
{
LowValue = gl;
AF_Value = AF_Value + Af;
if AF_Value >= AFMAX then AF_Value = AFMAX;
}
if gh > SAR_Value then
{
Direction = 1;
SAR_Value = EP;
AF_Value = 0;
EP = 0;
HighValue = gh;
}
}
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 gh > HighValue then
{
HighValue = gh;
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 gl < LowValue then
{
LowValue = gl;
AF_Value = AF_Value + AF;
if AF_Value >= AFMAX then AF_Value = AFMAX;
}
}
Sarv = SAR_Value;
}
else
{
if Direction == 0 then
{
if gc > gc[1] then Direction = 1;
else
if gc < gc[1] then Direction = -1;
}
else
{
if Direction == 1 then
{
if gc < gc[1] then
{
Direction = -1;
SAR_Value = HighValue;
Sarv = SAR_Value;
}
}
if Direction == -1 then
{
if gc > gc[1] then
{
Direction = 1;
SAR_Value = LowValue;
Sarv = SAR_Value;
}
}
}
LowValue = min(gl, LowValue);
HighValue = max(gh, HighValue);
}
}
plot1(sarv);
답변 1
예스스탁 예스스탁 답변
2012-02-02 15:11:53
안녕하세요
예스스탁입니다.
시스템식입니다.
Input : AF(0.02), AFMAX(0.2);
Var : Direction(0), SAR_Value(Close), AF_Value(.02), HighValue(h), LowValue(l), EP(0);
var : gap(0),sumgap(0),GO(0),GH(0),GL(0),GC(0),sarv(0);
if date!=date[1] then { // 날짜가 변경되는 봉에서(분봉에서 첫번째 봉)
gap = Open-Close[1]; // 일간갭
sumGap = sumGap+gap; // 일간갭 누적
}
GO = O - sumGap;// 갭보정 시가
GH = H - sumGap;// 갭보정 고가
GL = L - sumGap;// 갭보정 저가
GC = C - sumGap; // 갭보정 종가
if EP != 0 Then
{
if Direction == 1 then
{
EP = HighValue;
SAR_Value = SAR_Value + AF_Value * (EP - SAR_Value);
if gh > HighValue then
{
HighValue = gh;
AF_Value = AF_Value + AF;
if AF_Value >= AFMAX then AF_Value = AFMAX;
}
if gl < SAR_Value then
{
Direction = -1;
SAR_Value = EP;
AF_Value = 0;
EP = 0;
LowValue = gl;
}
}
else
{
EP = LowValue;
SAR_Value = SAR_Value + AF_Value * (EP - SAR_Value);
if gl < LowValue then
{
LowValue = gl;
AF_Value = AF_Value + Af;
if AF_Value >= AFMAX then AF_Value = AFMAX;
}
if gh > SAR_Value then
{
Direction = 1;
SAR_Value = EP;
AF_Value = 0;
EP = 0;
HighValue = gh;
}
}
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 gh > HighValue then
{
HighValue = gh;
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 gl < LowValue then
{
LowValue = gl;
AF_Value = AF_Value + AF;
if AF_Value >= AFMAX then AF_Value = AFMAX;
}
}
Sarv = SAR_Value;
}
else
{
if Direction == 0 then
{
if gc > gc[1] then Direction = 1;
else
if gc < gc[1] then Direction = -1;
}
else
{
if Direction == 1 then
{
if gc < gc[1] then
{
Direction = -1;
SAR_Value = HighValue;
Sarv = SAR_Value;
}
}
if Direction == -1 then
{
if gc > gc[1] then
{
Direction = 1;
SAR_Value = LowValue;
Sarv = SAR_Value;
}
}
}
LowValue = min(gl, LowValue);
HighValue = max(gh, HighValue);
}
}
If crossup(C, Sarv) Then
{
Buy();
}
If CrossDown(C, Sarv) Then
{
Sell();
}
즐거운 하루되세요
> 비츠로 님이 쓴 글입니다.
> 제목 : 문의 드립니다.
> 아래는 파라볼릭 갭보정식입니다.
시스템식으로 사용해보니 잘 안되는군요.
sarV = Sar(af,AFMAX);
여기서 막히네요.
매수매도식 좀 부탁드리겠습니다.
Input : AF(0.02), AFMAX(0.2);
Var : Direction(0), SAR_Value(Close), AF_Value(.02), HighValue(h), LowValue(l), EP(0);
var : gap(0),sumgap(0),GO(0),GH(0),GL(0),GC(0),sarv(0);
if date!=date[1] then { // 날짜가 변경되는 봉에서(분봉에서 첫번째 봉)
gap = Open-Close[1]; // 일간갭
sumGap = sumGap+gap; // 일간갭 누적
}
GO = O - sumGap;// 갭보정 시가
GH = H - sumGap;// 갭보정 고가
GL = L - sumGap;// 갭보정 저가
GC = C - sumGap; // 갭보정 종가
if EP != 0 Then
{
if Direction == 1 then
{
EP = HighValue;
SAR_Value = SAR_Value + AF_Value * (EP - SAR_Value);
if gh > HighValue then
{
HighValue = gh;
AF_Value = AF_Value + AF;
if AF_Value >= AFMAX then AF_Value = AFMAX;
}
if gl < SAR_Value then
{
Direction = -1;
SAR_Value = EP;
AF_Value = 0;
EP = 0;
LowValue = gl;
}
}
else
{
EP = LowValue;
SAR_Value = SAR_Value + AF_Value * (EP - SAR_Value);
if gl < LowValue then
{
LowValue = gl;
AF_Value = AF_Value + Af;
if AF_Value >= AFMAX then AF_Value = AFMAX;
}
if gh > SAR_Value then
{
Direction = 1;
SAR_Value = EP;
AF_Value = 0;
EP = 0;
HighValue = gh;
}
}
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 gh > HighValue then
{
HighValue = gh;
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 gl < LowValue then
{
LowValue = gl;
AF_Value = AF_Value + AF;
if AF_Value >= AFMAX then AF_Value = AFMAX;
}
}
Sarv = SAR_Value;
}
else
{
if Direction == 0 then
{
if gc > gc[1] then Direction = 1;
else
if gc < gc[1] then Direction = -1;
}
else
{
if Direction == 1 then
{
if gc < gc[1] then
{
Direction = -1;
SAR_Value = HighValue;
Sarv = SAR_Value;
}
}
if Direction == -1 then
{
if gc > gc[1] then
{
Direction = 1;
SAR_Value = LowValue;
Sarv = SAR_Value;
}
}
}
LowValue = min(gl, LowValue);
HighValue = max(gh, HighValue);
}
}
plot1(sarv);