커뮤니티
수식 문의
2018-11-14 14:51:05
194
글번호 123653
다음과 같은 수식을 도움 받고자 합니다.
1. 아래의 지표가 갭보정이 적용되도록 수정합니다.
2. 시초가~ N봉 까지는
봉이 1번 지표 중심선 라인을 데드크로스 하면 매도
골드크로스 하면 매수
N봉 이후에는 신호 없음.
2-1. 시초가 첫봉이 1번 지표 중심선 라인 위에 있으면
첫봉 종가에 매수
아래에 있으면 첫봉 종가에 매도.
3. 임의로 설정된 조건값 Var3,9,15,21 중
3개 이상 음수인 상태에서
주가가
1번지표 중심선 라인을 데드크로스 하면 매도
1번지표 밴드 상단선을 데드크로스 하면 매도
4. 임의로 설정된 조건값 Var3,9,15,21 중
3개 이상 양수인 상태에서
주가가
1번지표 중심선 라인을 골드크로스 하면 매수
1번지표 밴드 하단선을 골드크로스 하면 매수
항상 친절한 답변 감사드립니다.
========== 아래 =============
input: period(20);
var: efratio(0), smooth(1), fastend(0.666), slowend(0.0645), AMA(0), AMA2(0), AMA3(0),diff(0), signal(0), noise(0);
Var : SumSqrt(0), Avgv(0), Counter(0),Stdv(0);
efratio = 1;
diff = absvalue(C - C[1]);
if currentbar > period then {
signal = absvalue(C - C[period]);
noise = accumN(diff,period);
if noise <> 0 then efratio = signal / noise;
smooth = power(efratio*(fastend - slowend) + slowend,2);
AMA = AMA[1] + smooth*(C - AMA[1]);
}
else
AMA = C;
If period != 0 Then Begin
Avgv = ama;
SumSqrt = 0;
For Counter = 0 To period - 1 Begin
SumSqrt = SumSqrt + (c[Counter] - Avgv) * (c[Counter] - Avgv);
End;
Stdv = SquareRoot(SumSqrt / period);
End
Else
Stdv = 0;
value1 = ama+(stdv*dv);
value2 = ama-(stdv*dv);
plot1(ama,"쿠프먼필터1");
plot2(value1,"상단선");
plot3(value2,"하단선");
.
답변 4
예스스탁 예스스탁 답변
2018-11-14 15:22:46
안녕하세요
예스스탁입니다.
1
input: period(20),dv(2);
var : efratio(0), smooth(1), fastend(0.666), slowend(0.0645), AMA(0), AMA2(0), AMA3(0),diff(0), signal(0), noise(0);
Var : SumSqrt(0), Avgv(0), Counter(0),Stdv(0);
var : gap(0),sumgap(0),GC(0);
if bdate != bdate[1] THen// 날짜가 변경되는 봉에서(분봉에서 첫번째 봉)
{
gap = Open-Close[1]; // 일간갭
sumGap = sumGap+gap; // 일간갭 누적
}
GC = C - sumGap; // 갭보정 종가
efratio = 1;
diff = absvalue(GC - GC[1]);
if currentbar > period then
{
signal = absvalue(GC - GC[period]);
noise = accumN(diff,period);
if noise <> 0 then
efratio = signal / noise;
smooth = power(efratio*(fastend - slowend) + slowend,2);
AMA = AMA[1] + smooth*(GC - AMA[1]);
}
else
AMA = GC;
If period != 0 Then Begin
Avgv = ama;
SumSqrt = 0;
For Counter = 0 To period - 1 Begin
SumSqrt = SumSqrt + (GC[Counter] - Avgv) * (GC[Counter] - Avgv);
End;
Stdv = SquareRoot(SumSqrt / period);
End
Else
Stdv = 0;
value1 = ama+(stdv*dv);
value2 = ama-(stdv*dv);
plot1(ama,"쿠프먼필터1");
plot2(value1,"상단선");
plot3(value2,"하단선");
2
input: period(20),dv(2),n(20);
var : efratio(0), smooth(1), fastend(0.666), slowend(0.0645), AMA(0), AMA2(0), AMA3(0),diff(0), signal(0), noise(0);
Var : SumSqrt(0), Avgv(0), Counter(0),Stdv(0);
var : gap(0),sumgap(0),GC(0),idx(0);
if bdate != bdate[1] THen// 날짜가 변경되는 봉에서(분봉에서 첫번째 봉)
{
gap = Open-Close[1]; // 일간갭
sumGap = sumGap+gap; // 일간갭 누적
idx = 0;
}
Else
idx = idx+1;
GC = C - sumGap; // 갭보정 종가
efratio = 1;
diff = absvalue(GC - GC[1]);
if currentbar > period then
{
signal = absvalue(GC - GC[period]);
noise = accumN(diff,period);
if noise <> 0 then
efratio = signal / noise;
smooth = power(efratio*(fastend - slowend) + slowend,2);
AMA = AMA[1] + smooth*(GC - AMA[1]);
}
else
AMA = GC;
If period != 0 Then Begin
Avgv = ama;
SumSqrt = 0;
For Counter = 0 To period - 1 Begin
SumSqrt = SumSqrt + (GC[Counter] - Avgv) * (GC[Counter] - Avgv);
End;
Stdv = SquareRoot(SumSqrt / period);
End
Else
Stdv = 0;
value1 = ama+(stdv*dv);
value2 = ama-(stdv*dv);
if idx < n then
{
if (idx == 0 and c > ama) or (idx > 0 and crossup(c,ama)) then
buy();
if (idx == 0 and c < ama) or (idx > 0 and CrossDown(c,ama)) then
sell();
}
3
input: period(20),dv(2),n(20);
var : efratio(0), smooth(1), fastend(0.666), slowend(0.0645), AMA(0), AMA2(0), AMA3(0),diff(0), signal(0), noise(0);
Var : SumSqrt(0), Avgv(0), Counter(0),Stdv(0);
var : gap(0),sumgap(0),GC(0),idx(0),minus(0);
if bdate != bdate[1] THen// 날짜가 변경되는 봉에서(분봉에서 첫번째 봉)
{
gap = Open-Close[1]; // 일간갭
sumGap = sumGap+gap; // 일간갭 누적
idx = 0;
}
Else
idx = idx+1;
GC = C - sumGap; // 갭보정 종가
efratio = 1;
diff = absvalue(GC - GC[1]);
if currentbar > period then
{
signal = absvalue(GC - GC[period]);
noise = accumN(diff,period);
if noise <> 0 then
efratio = signal / noise;
smooth = power(efratio*(fastend - slowend) + slowend,2);
AMA = AMA[1] + smooth*(GC - AMA[1]);
}
else
AMA = GC;
If period != 0 Then Begin
Avgv = ama;
SumSqrt = 0;
For Counter = 0 To period - 1 Begin
SumSqrt = SumSqrt + (GC[Counter] - Avgv) * (GC[Counter] - Avgv);
End;
Stdv = SquareRoot(SumSqrt / period);
End
Else
Stdv = 0;
value1 = ama+(stdv*dv);
value2 = ama-(stdv*dv);
minus = 0;
if var3 < 0 Then
minus = minus+1;
if var9 < 0 Then
minus = minus+1;
if var15 < 0 Then
minus = minus+1;
if var21 < 0 Then
minus = minus+1;
if idx < n and minus >= 3 then
{
if (idx == 0 and c > ama) or (idx > 0 and crossup(c,ama)) then
buy();
if (idx == 0 and c < ama) or (idx > 0 and CrossDown(c,ama)) then
sell();
}
4
input: period(20),dv(2),n(20);
var : efratio(0), smooth(1), fastend(0.666), slowend(0.0645), AMA(0), AMA2(0), AMA3(0),diff(0), signal(0), noise(0);
Var : SumSqrt(0), Avgv(0), Counter(0),Stdv(0);
var : gap(0),sumgap(0),GC(0),idx(0),plus(0);
if bdate != bdate[1] THen// 날짜가 변경되는 봉에서(분봉에서 첫번째 봉)
{
gap = Open-Close[1]; // 일간갭
sumGap = sumGap+gap; // 일간갭 누적
idx = 0;
}
Else
idx = idx+1;
GC = C - sumGap; // 갭보정 종가
efratio = 1;
diff = absvalue(GC - GC[1]);
if currentbar > period then
{
signal = absvalue(GC - GC[period]);
noise = accumN(diff,period);
if noise <> 0 then
efratio = signal / noise;
smooth = power(efratio*(fastend - slowend) + slowend,2);
AMA = AMA[1] + smooth*(GC - AMA[1]);
}
else
AMA = GC;
If period != 0 Then Begin
Avgv = ama;
SumSqrt = 0;
For Counter = 0 To period - 1 Begin
SumSqrt = SumSqrt + (GC[Counter] - Avgv) * (GC[Counter] - Avgv);
End;
Stdv = SquareRoot(SumSqrt / period);
End
Else
Stdv = 0;
value1 = ama+(stdv*dv);
value2 = ama-(stdv*dv);
plus = 0;
if var3 > 0 Then
plus = plus+1;
if var9 > 0 Then
plus = plus+1;
if var15 > 0 Then
plus = plus+1;
if var21 > 0 Then
plus = plus+1;
if idx < n and plus >= 3 then
{
if (idx == 0 and c > ama) or (idx > 0 and crossup(c,ama)) then
buy();
if (idx == 0 and c < ama) or (idx > 0 and CrossDown(c,ama)) then
sell();
}
즐거우 하루되세요
> 흑수돌 님이 쓴 글입니다.
> 제목 : 수식 문의
> 다음과 같은 수식을 도움 받고자 합니다.
1. 아래의 지표가 갭보정이 적용되도록 수정합니다.
2. 시초가~ N봉 까지는
봉이 1번 지표 중심선 라인을 데드크로스 하면 매도
골드크로스 하면 매수
N봉 이후에는 신호 없음.
2-1. 시초가 첫봉이 1번 지표 중심선 라인 위에 있으면
첫봉 종가에 매수
아래에 있으면 첫봉 종가에 매도.
3. 임의로 설정된 조건값 Var3,9,15,21 중
3개 이상 음수인 상태에서
주가가
1번지표 중심선 라인을 데드크로스 하면 매도
1번지표 밴드 상단선을 데드크로스 하면 매도
4. 임의로 설정된 조건값 Var3,9,15,21 중
3개 이상 양수인 상태에서
주가가
1번지표 중심선 라인을 골드크로스 하면 매수
1번지표 밴드 하단선을 골드크로스 하면 매수
항상 친절한 답변 감사드립니다.
========== 아래 =============
input: period(20);
var: efratio(0), smooth(1), fastend(0.666), slowend(0.0645), AMA(0), AMA2(0), AMA3(0),diff(0), signal(0), noise(0);
Var : SumSqrt(0), Avgv(0), Counter(0),Stdv(0);
efratio = 1;
diff = absvalue(C - C[1]);
if currentbar > period then {
signal = absvalue(C - C[period]);
noise = accumN(diff,period);
if noise <> 0 then efratio = signal / noise;
smooth = power(efratio*(fastend - slowend) + slowend,2);
AMA = AMA[1] + smooth*(C - AMA[1]);
}
else
AMA = C;
If period != 0 Then Begin
Avgv = ama;
SumSqrt = 0;
For Counter = 0 To period - 1 Begin
SumSqrt = SumSqrt + (c[Counter] - Avgv) * (c[Counter] - Avgv);
End;
Stdv = SquareRoot(SumSqrt / period);
End
Else
Stdv = 0;
value1 = ama+(stdv*dv);
value2 = ama-(stdv*dv);
plot1(ama,"쿠프먼필터1");
plot2(value1,"상단선");
plot3(value2,"하단선");
.
흑수돌
2018-11-14 16:34:01
ㄱ.
아래에 요청한 수식
2, 2-1, 3,4 조건을
모두 하나의 수식 안에 넣어 주십사 한 요청이었는데,
제가 설명이 충분치 못하였나 봅니다.
ㄴ.
2, 2-1 수식은 봉차트의 갭보정을 풀면 전혀 다른 신호를 냅니다.
봉차트의 갭보정을 풀어도
지표 수식은 갭보정이 되어 있는 것 처럼 차트를 인식하고
신호를 내고 싶습니다.
ㄷ. 아마도 기준이 되는 갭보정 쿠프먼 필터가 잘 못된 듯 합니다.
도움 주신 갭보정 지표를 지표만 적용해서 깔아 보았는데 전혀 맞지 않습니다.
어디가 잘 못되었는지 모르겠사오니
수정을 부탁드립니다.
감사합니다.
> 예스스탁 님이 쓴 글입니다.
> 제목 : Re : 수식 문의
>
안녕하세요
예스스탁입니다.
1
input: period(20),dv(2);
var : efratio(0), smooth(1), fastend(0.666), slowend(0.0645), AMA(0), AMA2(0), AMA3(0),diff(0), signal(0), noise(0);
Var : SumSqrt(0), Avgv(0), Counter(0),Stdv(0);
var : gap(0),sumgap(0),GC(0);
if bdate != bdate[1] THen// 날짜가 변경되는 봉에서(분봉에서 첫번째 봉)
{
gap = Open-Close[1]; // 일간갭
sumGap = sumGap+gap; // 일간갭 누적
}
GC = C - sumGap; // 갭보정 종가
efratio = 1;
diff = absvalue(GC - GC[1]);
if currentbar > period then
{
signal = absvalue(GC - GC[period]);
noise = accumN(diff,period);
if noise <> 0 then
efratio = signal / noise;
smooth = power(efratio*(fastend - slowend) + slowend,2);
AMA = AMA[1] + smooth*(GC - AMA[1]);
}
else
AMA = GC;
If period != 0 Then Begin
Avgv = ama;
SumSqrt = 0;
For Counter = 0 To period - 1 Begin
SumSqrt = SumSqrt + (GC[Counter] - Avgv) * (GC[Counter] - Avgv);
End;
Stdv = SquareRoot(SumSqrt / period);
End
Else
Stdv = 0;
value1 = ama+(stdv*dv);
value2 = ama-(stdv*dv);
plot1(ama,"쿠프먼필터1");
plot2(value1,"상단선");
plot3(value2,"하단선");
2
input: period(20),dv(2),n(20);
var : efratio(0), smooth(1), fastend(0.666), slowend(0.0645), AMA(0), AMA2(0), AMA3(0),diff(0), signal(0), noise(0);
Var : SumSqrt(0), Avgv(0), Counter(0),Stdv(0);
var : gap(0),sumgap(0),GC(0),idx(0);
if bdate != bdate[1] THen// 날짜가 변경되는 봉에서(분봉에서 첫번째 봉)
{
gap = Open-Close[1]; // 일간갭
sumGap = sumGap+gap; // 일간갭 누적
idx = 0;
}
Else
idx = idx+1;
GC = C - sumGap; // 갭보정 종가
efratio = 1;
diff = absvalue(GC - GC[1]);
if currentbar > period then
{
signal = absvalue(GC - GC[period]);
noise = accumN(diff,period);
if noise <> 0 then
efratio = signal / noise;
smooth = power(efratio*(fastend - slowend) + slowend,2);
AMA = AMA[1] + smooth*(GC - AMA[1]);
}
else
AMA = GC;
If period != 0 Then Begin
Avgv = ama;
SumSqrt = 0;
For Counter = 0 To period - 1 Begin
SumSqrt = SumSqrt + (GC[Counter] - Avgv) * (GC[Counter] - Avgv);
End;
Stdv = SquareRoot(SumSqrt / period);
End
Else
Stdv = 0;
value1 = ama+(stdv*dv);
value2 = ama-(stdv*dv);
if idx < n then
{
if (idx == 0 and c > ama) or (idx > 0 and crossup(c,ama)) then
buy();
if (idx == 0 and c < ama) or (idx > 0 and CrossDown(c,ama)) then
sell();
}
3
input: period(20),dv(2),n(20);
var : efratio(0), smooth(1), fastend(0.666), slowend(0.0645), AMA(0), AMA2(0), AMA3(0),diff(0), signal(0), noise(0);
Var : SumSqrt(0), Avgv(0), Counter(0),Stdv(0);
var : gap(0),sumgap(0),GC(0),idx(0),minus(0);
if bdate != bdate[1] THen// 날짜가 변경되는 봉에서(분봉에서 첫번째 봉)
{
gap = Open-Close[1]; // 일간갭
sumGap = sumGap+gap; // 일간갭 누적
idx = 0;
}
Else
idx = idx+1;
GC = C - sumGap; // 갭보정 종가
efratio = 1;
diff = absvalue(GC - GC[1]);
if currentbar > period then
{
signal = absvalue(GC - GC[period]);
noise = accumN(diff,period);
if noise <> 0 then
efratio = signal / noise;
smooth = power(efratio*(fastend - slowend) + slowend,2);
AMA = AMA[1] + smooth*(GC - AMA[1]);
}
else
AMA = GC;
If period != 0 Then Begin
Avgv = ama;
SumSqrt = 0;
For Counter = 0 To period - 1 Begin
SumSqrt = SumSqrt + (GC[Counter] - Avgv) * (GC[Counter] - Avgv);
End;
Stdv = SquareRoot(SumSqrt / period);
End
Else
Stdv = 0;
value1 = ama+(stdv*dv);
value2 = ama-(stdv*dv);
minus = 0;
if var3 < 0 Then
minus = minus+1;
if var9 < 0 Then
minus = minus+1;
if var15 < 0 Then
minus = minus+1;
if var21 < 0 Then
minus = minus+1;
if idx < n and minus >= 3 then
{
if (idx == 0 and c > ama) or (idx > 0 and crossup(c,ama)) then
buy();
if (idx == 0 and c < ama) or (idx > 0 and CrossDown(c,ama)) then
sell();
}
4
input: period(20),dv(2),n(20);
var : efratio(0), smooth(1), fastend(0.666), slowend(0.0645), AMA(0), AMA2(0), AMA3(0),diff(0), signal(0), noise(0);
Var : SumSqrt(0), Avgv(0), Counter(0),Stdv(0);
var : gap(0),sumgap(0),GC(0),idx(0),plus(0);
if bdate != bdate[1] THen// 날짜가 변경되는 봉에서(분봉에서 첫번째 봉)
{
gap = Open-Close[1]; // 일간갭
sumGap = sumGap+gap; // 일간갭 누적
idx = 0;
}
Else
idx = idx+1;
GC = C - sumGap; // 갭보정 종가
efratio = 1;
diff = absvalue(GC - GC[1]);
if currentbar > period then
{
signal = absvalue(GC - GC[period]);
noise = accumN(diff,period);
if noise <> 0 then
efratio = signal / noise;
smooth = power(efratio*(fastend - slowend) + slowend,2);
AMA = AMA[1] + smooth*(GC - AMA[1]);
}
else
AMA = GC;
If period != 0 Then Begin
Avgv = ama;
SumSqrt = 0;
For Counter = 0 To period - 1 Begin
SumSqrt = SumSqrt + (GC[Counter] - Avgv) * (GC[Counter] - Avgv);
End;
Stdv = SquareRoot(SumSqrt / period);
End
Else
Stdv = 0;
value1 = ama+(stdv*dv);
value2 = ama-(stdv*dv);
plus = 0;
if var3 > 0 Then
plus = plus+1;
if var9 > 0 Then
plus = plus+1;
if var15 > 0 Then
plus = plus+1;
if var21 > 0 Then
plus = plus+1;
if idx < n and plus >= 3 then
{
if (idx == 0 and c > ama) or (idx > 0 and crossup(c,ama)) then
buy();
if (idx == 0 and c < ama) or (idx > 0 and CrossDown(c,ama)) then
sell();
}
즐거우 하루되세요
> 흑수돌 님이 쓴 글입니다.
> 제목 : 수식 문의
> 다음과 같은 수식을 도움 받고자 합니다.
1. 아래의 지표가 갭보정이 적용되도록 수정합니다.
2. 시초가~ N봉 까지는
봉이 1번 지표 중심선 라인을 데드크로스 하면 매도
골드크로스 하면 매수
N봉 이후에는 신호 없음.
2-1. 시초가 첫봉이 1번 지표 중심선 라인 위에 있으면
첫봉 종가에 매수
아래에 있으면 첫봉 종가에 매도.
3. 임의로 설정된 조건값 Var3,9,15,21 중
3개 이상 음수인 상태에서
주가가
1번지표 중심선 라인을 데드크로스 하면 매도
1번지표 밴드 상단선을 데드크로스 하면 매도
4. 임의로 설정된 조건값 Var3,9,15,21 중
3개 이상 양수인 상태에서
주가가
1번지표 중심선 라인을 골드크로스 하면 매수
1번지표 밴드 하단선을 골드크로스 하면 매수
항상 친절한 답변 감사드립니다.
========== 아래 =============
input: period(20);
var: efratio(0), smooth(1), fastend(0.666), slowend(0.0645), AMA(0), AMA2(0), AMA3(0),diff(0), signal(0), noise(0);
Var : SumSqrt(0), Avgv(0), Counter(0),Stdv(0);
efratio = 1;
diff = absvalue(C - C[1]);
if currentbar > period then {
signal = absvalue(C - C[period]);
noise = accumN(diff,period);
if noise <> 0 then efratio = signal / noise;
smooth = power(efratio*(fastend - slowend) + slowend,2);
AMA = AMA[1] + smooth*(C - AMA[1]);
}
else
AMA = C;
If period != 0 Then Begin
Avgv = ama;
SumSqrt = 0;
For Counter = 0 To period - 1 Begin
SumSqrt = SumSqrt + (c[Counter] - Avgv) * (c[Counter] - Avgv);
End;
Stdv = SquareRoot(SumSqrt / period);
End
Else
Stdv = 0;
value1 = ama+(stdv*dv);
value2 = ama-(stdv*dv);
plot1(ama,"쿠프먼필터1");
plot2(value1,"상단선");
plot3(value2,"하단선");
.
예스스탁 예스스탁 답변
2018-11-14 17:20:08
안녕하세요
예스스탁입니다.
수식문의에 갭보정이라고 질문주시면
수식상 갭보정을 하는 내용으로 작성합니다.
수식상 갭보정은 차트의 갭보정과 다릅니다.
차트의 갭보정은 당일봉을 고정한채로 과거로 가면서 데이터 자체를 보정합니다.
하지만 수식은 과거로 가면서 값을 계산하지는 못하므로
수식상 갭보정은 차트의 첫봉부터 마지막봉으로 시간순으로 진행하면서
날짜가 변경되면 갭을 모아 자체적으로 보정된 가격을 계산합니다.
그러므로 오늘 날짜에서 보면 계산된 지표가 봉과 상단한 이격을 가질수 있습니다.
수식안에서 차트의 갭보정한것과 같이 데이터를 만들지는 못합니다.
이는 차트 자체는 보정하지 않은 데이터를 이용하면서
일간갭에 제거해 지표를 보고자할때 사용합니다.
차트의 기능으로 제공하는 갭보정과는 성격이 다른 내용이고
계산값 자체도 많이 차이납니다
차트기능으로 직접 데이터를 보정해서 수식을 적용하는 내용이면
수식안에서 처리하는 내용이 없습니다.
랭귀지는 차트의 봉에서 값을 읽어 계산하므로
차트상 갭보정을 하면 보정된 데이터를 사용하고
갭보정을 안하면 안한데이터를 사용합니다.
수식을 2개 올려드립니다.
기본답변 수식과 같이 차트상 갭보정하지 않은상태에서 수식상 갭보정해 사용하는 수식과
차트상 설정된 데이터를 그대로 사용하는 수식입니다.
1
input: period(20),dv(2),n(20);
var : efratio(0), smooth(1), fastend(0.666), slowend(0.0645), AMA(0), AMA2(0), AMA3(0),diff(0), signal(0), noise(0);
Var : SumSqrt(0), Avgv(0), Counter(0),Stdv(0);
var : gap(0),sumgap(0),GC(0),idx(0),plus(0),minus(0);
if bdate != bdate[1] THen// 날짜가 변경되는 봉에서(분봉에서 첫번째 봉)
{
gap = Open-Close[1]; // 일간갭
sumGap = sumGap+gap; // 일간갭 누적
idx = 0;
}
Else
idx = idx+1;
GC = C - sumGap; // 갭보정 종가
efratio = 1;
diff = absvalue(GC - GC[1]);
if currentbar > period then
{
signal = absvalue(GC - GC[period]);
noise = accumN(diff,period);
if noise <> 0 then
efratio = signal / noise;
smooth = power(efratio*(fastend - slowend) + slowend,2);
AMA = AMA[1] + smooth*(GC - AMA[1]);
}
else
AMA = GC;
If period != 0 Then Begin
Avgv = ama;
SumSqrt = 0;
For Counter = 0 To period - 1 Begin
SumSqrt = SumSqrt + (GC[Counter] - Avgv) * (GC[Counter] - Avgv);
End;
Stdv = SquareRoot(SumSqrt / period);
End
Else
Stdv = 0;
value1 = ama+(stdv*dv);
value2 = ama-(stdv*dv);
plus = 0;
if var3 > 0 Then
plus = plus+1;
if var9 > 0 Then
plus = plus+1;
if var15 > 0 Then
plus = plus+1;
if var21 > 0 Then
plus = plus+1;
minus = 0;
if var3 < 0 Then
minus = minus+1;
if var9 < 0 Then
minus = minus+1;
if var15 < 0 Then
minus = minus+1;
if var21 < 0 Then
minus = minus+1;
if idx < n then
{
if (idx == 0 and gc > ama) or (idx > 0 and crossup(gc,ama)) then
buy();
if (idx == 0 and gc < ama) or (idx > 0 and CrossDown(gc,ama)) then
sell();
if plus >= 3 Then
{
if (idx == 0 and gc > ama) or (idx > 0 and crossup(gc,ama)) then
buy();
if (idx == 0 and gc < ama) or (idx > 0 and CrossDown(gc,ama)) then
sell();
}
if minus >= 3 then
{
if (idx == 0 and gc > ama) or (idx > 0 and crossup(gc,ama)) then
buy();
if (idx == 0 and gc < ama) or (idx > 0 and CrossDown(gc,ama)) then
sell();
}
}
2
input: period(20),dv(2),n(20);
var : efratio(0), smooth(1), fastend(0.666), slowend(0.0645);
var : AMA(0), AMA2(0), AMA3(0),diff(0), signal(0), noise(0);
Var : SumSqrt(0), Avgv(0), Counter(0),Stdv(0),plus(0),minus(0),idx(0);
if bdate != bdate[1] THen
idx = 0;
Else
idx = idx+1;
efratio = 1;
diff = absvalue(C - C[1]);
if currentbar > period then {
signal = absvalue(C - C[period]);
noise = accumN(diff,period);
if noise <> 0 then efratio = signal / noise;
smooth = power(efratio*(fastend - slowend) + slowend,2);
AMA = AMA[1] + smooth*(C - AMA[1]);
}
else
AMA = C;
If period != 0 Then Begin
Avgv = ama;
SumSqrt = 0;
For Counter = 0 To period - 1 Begin
SumSqrt = SumSqrt + (c[Counter] - Avgv) * (c[Counter] - Avgv);
End;
Stdv = SquareRoot(SumSqrt / period);
End
Else
Stdv = 0;
value1 = ama+(stdv*dv);
value2 = ama-(stdv*dv);
plus = 0;
if var3 > 0 Then
plus = plus+1;
if var9 > 0 Then
plus = plus+1;
if var15 > 0 Then
plus = plus+1;
if var21 > 0 Then
plus = plus+1;
minus = 0;
if var3 < 0 Then
minus = minus+1;
if var9 < 0 Then
minus = minus+1;
if var15 < 0 Then
minus = minus+1;
if var21 < 0 Then
minus = minus+1;
if idx < n then
{
if (idx == 0 and c > ama) or (idx > 0 and crossup(c,ama)) then
buy();
if (idx == 0 and c < ama) or (idx > 0 and CrossDown(c,ama)) then
sell();
if plus >= 3 Then
{
if (idx == 0 and c > ama) or (idx > 0 and crossup(c,ama)) then
buy();
if (idx == 0 and c < ama) or (idx > 0 and CrossDown(c,ama)) then
sell();
}
if minus >= 3 then
{
if (idx == 0 and c > ama) or (idx > 0 and crossup(c,ama)) then
buy();
if (idx == 0 and c < ama) or (idx > 0 and CrossDown(c,ama)) then
sell();
}
}
즐거운 하루되세요
> 흑수돌 님이 쓴 글입니다.
> 제목 : Re : Re : 수식 오류 정정 요청
>
ㄱ.
아래에 요청한 수식
2, 2-1, 3,4 조건을
모두 하나의 수식 안에 넣어 주십사 한 요청이었는데,
제가 설명이 충분치 못하였나 봅니다.
ㄴ.
2, 2-1 수식은 봉차트의 갭보정을 풀면 전혀 다른 신호를 냅니다.
봉차트의 갭보정을 풀어도
지표 수식은 갭보정이 되어 있는 것 처럼 차트를 인식하고
신호를 내고 싶습니다.
ㄷ. 아마도 기준이 되는 갭보정 쿠프먼 필터가 잘 못된 듯 합니다.
도움 주신 갭보정 지표를 지표만 적용해서 깔아 보았는데 전혀 맞지 않습니다.
어디가 잘 못되었는지 모르겠사오니
수정을 부탁드립니다.
감사합니다.
> 예스스탁 님이 쓴 글입니다.
> 제목 : Re : 수식 문의
>
안녕하세요
예스스탁입니다.
1
input: period(20),dv(2);
var : efratio(0), smooth(1), fastend(0.666), slowend(0.0645), AMA(0), AMA2(0), AMA3(0),diff(0), signal(0), noise(0);
Var : SumSqrt(0), Avgv(0), Counter(0),Stdv(0);
var : gap(0),sumgap(0),GC(0);
if bdate != bdate[1] THen// 날짜가 변경되는 봉에서(분봉에서 첫번째 봉)
{
gap = Open-Close[1]; // 일간갭
sumGap = sumGap+gap; // 일간갭 누적
}
GC = C - sumGap; // 갭보정 종가
efratio = 1;
diff = absvalue(GC - GC[1]);
if currentbar > period then
{
signal = absvalue(GC - GC[period]);
noise = accumN(diff,period);
if noise <> 0 then
efratio = signal / noise;
smooth = power(efratio*(fastend - slowend) + slowend,2);
AMA = AMA[1] + smooth*(GC - AMA[1]);
}
else
AMA = GC;
If period != 0 Then Begin
Avgv = ama;
SumSqrt = 0;
For Counter = 0 To period - 1 Begin
SumSqrt = SumSqrt + (GC[Counter] - Avgv) * (GC[Counter] - Avgv);
End;
Stdv = SquareRoot(SumSqrt / period);
End
Else
Stdv = 0;
value1 = ama+(stdv*dv);
value2 = ama-(stdv*dv);
plot1(ama,"쿠프먼필터1");
plot2(value1,"상단선");
plot3(value2,"하단선");
2
input: period(20),dv(2),n(20);
var : efratio(0), smooth(1), fastend(0.666), slowend(0.0645), AMA(0), AMA2(0), AMA3(0),diff(0), signal(0), noise(0);
Var : SumSqrt(0), Avgv(0), Counter(0),Stdv(0);
var : gap(0),sumgap(0),GC(0),idx(0);
if bdate != bdate[1] THen// 날짜가 변경되는 봉에서(분봉에서 첫번째 봉)
{
gap = Open-Close[1]; // 일간갭
sumGap = sumGap+gap; // 일간갭 누적
idx = 0;
}
Else
idx = idx+1;
GC = C - sumGap; // 갭보정 종가
efratio = 1;
diff = absvalue(GC - GC[1]);
if currentbar > period then
{
signal = absvalue(GC - GC[period]);
noise = accumN(diff,period);
if noise <> 0 then
efratio = signal / noise;
smooth = power(efratio*(fastend - slowend) + slowend,2);
AMA = AMA[1] + smooth*(GC - AMA[1]);
}
else
AMA = GC;
If period != 0 Then Begin
Avgv = ama;
SumSqrt = 0;
For Counter = 0 To period - 1 Begin
SumSqrt = SumSqrt + (GC[Counter] - Avgv) * (GC[Counter] - Avgv);
End;
Stdv = SquareRoot(SumSqrt / period);
End
Else
Stdv = 0;
value1 = ama+(stdv*dv);
value2 = ama-(stdv*dv);
if idx < n then
{
if (idx == 0 and c > ama) or (idx > 0 and crossup(c,ama)) then
buy();
if (idx == 0 and c < ama) or (idx > 0 and CrossDown(c,ama)) then
sell();
}
3
input: period(20),dv(2),n(20);
var : efratio(0), smooth(1), fastend(0.666), slowend(0.0645), AMA(0), AMA2(0), AMA3(0),diff(0), signal(0), noise(0);
Var : SumSqrt(0), Avgv(0), Counter(0),Stdv(0);
var : gap(0),sumgap(0),GC(0),idx(0),minus(0);
if bdate != bdate[1] THen// 날짜가 변경되는 봉에서(분봉에서 첫번째 봉)
{
gap = Open-Close[1]; // 일간갭
sumGap = sumGap+gap; // 일간갭 누적
idx = 0;
}
Else
idx = idx+1;
GC = C - sumGap; // 갭보정 종가
efratio = 1;
diff = absvalue(GC - GC[1]);
if currentbar > period then
{
signal = absvalue(GC - GC[period]);
noise = accumN(diff,period);
if noise <> 0 then
efratio = signal / noise;
smooth = power(efratio*(fastend - slowend) + slowend,2);
AMA = AMA[1] + smooth*(GC - AMA[1]);
}
else
AMA = GC;
If period != 0 Then Begin
Avgv = ama;
SumSqrt = 0;
For Counter = 0 To period - 1 Begin
SumSqrt = SumSqrt + (GC[Counter] - Avgv) * (GC[Counter] - Avgv);
End;
Stdv = SquareRoot(SumSqrt / period);
End
Else
Stdv = 0;
value1 = ama+(stdv*dv);
value2 = ama-(stdv*dv);
minus = 0;
if var3 < 0 Then
minus = minus+1;
if var9 < 0 Then
minus = minus+1;
if var15 < 0 Then
minus = minus+1;
if var21 < 0 Then
minus = minus+1;
if idx < n and minus >= 3 then
{
if (idx == 0 and c > ama) or (idx > 0 and crossup(c,ama)) then
buy();
if (idx == 0 and c < ama) or (idx > 0 and CrossDown(c,ama)) then
sell();
}
4
input: period(20),dv(2),n(20);
var : efratio(0), smooth(1), fastend(0.666), slowend(0.0645), AMA(0), AMA2(0), AMA3(0),diff(0), signal(0), noise(0);
Var : SumSqrt(0), Avgv(0), Counter(0),Stdv(0);
var : gap(0),sumgap(0),GC(0),idx(0),plus(0);
if bdate != bdate[1] THen// 날짜가 변경되는 봉에서(분봉에서 첫번째 봉)
{
gap = Open-Close[1]; // 일간갭
sumGap = sumGap+gap; // 일간갭 누적
idx = 0;
}
Else
idx = idx+1;
GC = C - sumGap; // 갭보정 종가
efratio = 1;
diff = absvalue(GC - GC[1]);
if currentbar > period then
{
signal = absvalue(GC - GC[period]);
noise = accumN(diff,period);
if noise <> 0 then
efratio = signal / noise;
smooth = power(efratio*(fastend - slowend) + slowend,2);
AMA = AMA[1] + smooth*(GC - AMA[1]);
}
else
AMA = GC;
If period != 0 Then Begin
Avgv = ama;
SumSqrt = 0;
For Counter = 0 To period - 1 Begin
SumSqrt = SumSqrt + (GC[Counter] - Avgv) * (GC[Counter] - Avgv);
End;
Stdv = SquareRoot(SumSqrt / period);
End
Else
Stdv = 0;
value1 = ama+(stdv*dv);
value2 = ama-(stdv*dv);
plus = 0;
if var3 > 0 Then
plus = plus+1;
if var9 > 0 Then
plus = plus+1;
if var15 > 0 Then
plus = plus+1;
if var21 > 0 Then
plus = plus+1;
if idx < n and plus >= 3 then
{
if (idx == 0 and c > ama) or (idx > 0 and crossup(c,ama)) then
buy();
if (idx == 0 and c < ama) or (idx > 0 and CrossDown(c,ama)) then
sell();
}
즐거우 하루되세요
> 흑수돌 님이 쓴 글입니다.
> 제목 : 수식 문의
> 다음과 같은 수식을 도움 받고자 합니다.
1. 아래의 지표가 갭보정이 적용되도록 수정합니다.
2. 시초가~ N봉 까지는
봉이 1번 지표 중심선 라인을 데드크로스 하면 매도
골드크로스 하면 매수
N봉 이후에는 신호 없음.
2-1. 시초가 첫봉이 1번 지표 중심선 라인 위에 있으면
첫봉 종가에 매수
아래에 있으면 첫봉 종가에 매도.
3. 임의로 설정된 조건값 Var3,9,15,21 중
3개 이상 음수인 상태에서
주가가
1번지표 중심선 라인을 데드크로스 하면 매도
1번지표 밴드 상단선을 데드크로스 하면 매도
4. 임의로 설정된 조건값 Var3,9,15,21 중
3개 이상 양수인 상태에서
주가가
1번지표 중심선 라인을 골드크로스 하면 매수
1번지표 밴드 하단선을 골드크로스 하면 매수
항상 친절한 답변 감사드립니다.
========== 아래 =============
input: period(20);
var: efratio(0), smooth(1), fastend(0.666), slowend(0.0645), AMA(0), AMA2(0), AMA3(0),diff(0), signal(0), noise(0);
Var : SumSqrt(0), Avgv(0), Counter(0),Stdv(0);
efratio = 1;
diff = absvalue(C - C[1]);
if currentbar > period then {
signal = absvalue(C - C[period]);
noise = accumN(diff,period);
if noise <> 0 then efratio = signal / noise;
smooth = power(efratio*(fastend - slowend) + slowend,2);
AMA = AMA[1] + smooth*(C - AMA[1]);
}
else
AMA = C;
If period != 0 Then Begin
Avgv = ama;
SumSqrt = 0;
For Counter = 0 To period - 1 Begin
SumSqrt = SumSqrt + (c[Counter] - Avgv) * (c[Counter] - Avgv);
End;
Stdv = SquareRoot(SumSqrt / period);
End
Else
Stdv = 0;
value1 = ama+(stdv*dv);
value2 = ama-(stdv*dv);
plot1(ama,"쿠프먼필터1");
plot2(value1,"상단선");
plot3(value2,"하단선");
.
흑수돌
2018-11-14 17:57:56
ㅇ
다음글
이전글