커뮤니티
수식 문의
2012-01-16 12:17:10
454
글번호 46649
안녕하세요. 항상 수고해 주셔서 감사드립니다.
설이 얼마 남지 않았습니다.
올해에도 항상 만복이 깃드시기 바랍니다.
---------
아래는 기본 지표에 있는 '세븐바이너리지표'를 갭보정하여
매수,매도가 나올 수 있도록 시스템 수식으로 만든 것입니다.
아래 수식을 바탕으로
매수신호가 나오면 해당캔들의 저점에 점을 찍고 그 점을 n2봉간 옆으로 늘려주고
매도신호가 나오면 해당캔들의 고점에 점을 찍고 그 점을n2봉간 옆으로 늘려주는
지표를 얻고 싶습니다.
감사합니다.
--------아래 --------------
Input: shortPeriod(13), longPeriod(26), Period(6), maPeriod(13), ROCPeriod(9), stoPeriod1(10),
stoPeriod2(6), CCIPeriod(9);
input: P1(13),P2(26),P3(6);
var: value(0),BW_SEVEN(0);
var : sumGap(0), gap(0), GO(0), GH(0), GL(0), GC(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; // 종가에서 갭누적값을 차감
//문장1 : MACD가 MACD 시그널선 보다 큼
if ema(gC,shortPeriod)-ema(gC,longPeriod) >= ema(ema(gC,shortPeriod)-ema(gC,longPeriod),Period) then
value = 1;
else
value = -1;
//문장2 : 종가가 이동평균선보다 큼
if gC >= ma(gC, maPeriod) then
value = value + 1;
else
value = value - 1;
//문장3 : Price ROC가 0선보다 큼
if (gC - gC[ROCPeriod]) / gC[ROCPeriod] * 100 >= 0 then
value = value + 1;
else
value = value - 1;
//문장4 : StochasticsK선이 50선 보다 큼
if ema((gC-lowest(gL, stoPeriod1)) / (highest(gH, stoPeriod1) - lowest(gL, stoPeriod1)) * 100, stoPeriod2)>=50 then
value = value + 1;
else
value = value - 1;
Variables: Sum(0), CCIcount(0), MD(0), Avgvalue(0),CCIV(0);
If CCIPeriod > 0 Then Begin
Avgvalue = Ma(GH + gL + GC, CCIPeriod);
MD = 0;
For CCIcount = 0 To CCIPeriod - 1 Begin
MD = MD + Abs(GH[CCIcount] + gL[CCIcount] + GC[CCIcount] - Avgvalue);
End;
MD = MD / CCIPeriod;
If MD == 0 Then
CCIv = 0;
Else
CCIv = (GH + gL + GC - Avgvalue) / (0.015 * MD);
End
Else
CCIv = 0;
//CCI가 0선 보다 큼
if CCIv > 0 then
value = value + 1;
else
value = value - 1;
//CO가 0선 보다 큼
if ema(accum(((gC -gL)-(gH- gC))/ (gH-gL)*V), 3) - ema(accum(((gC -gL)-(gH- gC))/(gH-gL)*V), 10) >=0 then
value = value + 1;
else
value = value - 1;
input : AF(0.02),AFMAX(0.2);
Var : Direction(0), SAR_Value(Close), AF_Value(.02), HighValue(h), LowValue(l), EP(0),Sarv(0);
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);
}
}
//문장7 : 종가가 파라볼릭보다 큼
if Sarv < gC then
value = value + 1;
else
value = value - 1;
BW_SEVEN = value;
var1 = ema(BW_SEVEN,P1)- ema(BW_SEVEN,P2);
var2 = ema(var1,P3);
var3 = var1-var2;
# 매수/매도청산
If CrossUp(value,1) Then
{
Buy();
}
# 매도/매수청산
If CrossDown(value,-1) Then
{
Sell();
}
답변 1
예스스탁 예스스탁 답변
2012-01-16 16:11:05
안녕하세요
예스스탁입니다.
Input: shortPeriod(13), longPeriod(26), Period(6), maPeriod(13), ROCPeriod(9), stoPeriod1(10),
stoPeriod2(6), CCIPeriod(9),n2(5);
input: P1(13),P2(26),P3(6);
var: value(0),BW_SEVEN(0);
var : sumGap(0), gap(0), GO(0), GH(0), GL(0), GC(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; // 종가에서 갭누적값을 차감
//문장1 : MACD가 MACD 시그널선 보다 큼
if ema(gC,shortPeriod)-ema(gC,longPeriod) >= ema(ema(gC,shortPeriod)-ema(gC,longPeriod),Period) then
value = 1;
else
value = -1;
//문장2 : 종가가 이동평균선보다 큼
if gC >= ma(gC, maPeriod) then
value = value + 1;
else
value = value - 1;
//문장3 : Price ROC가 0선보다 큼
if (gC - gC[ROCPeriod]) / gC[ROCPeriod] * 100 >= 0 then
value = value + 1;
else
value = value - 1;
//문장4 : StochasticsK선이 50선 보다 큼
if ema((gC-lowest(gL, stoPeriod1)) / (highest(gH, stoPeriod1) - lowest(gL, stoPeriod1)) * 100, stoPeriod2)>=50 then
value = value + 1;
else
value = value - 1;
Variables: Sum(0), CCIcount(0), MD(0), Avgvalue(0),CCIV(0);
If CCIPeriod > 0 Then Begin
Avgvalue = Ma(GH + gL + GC, CCIPeriod);
MD = 0;
For CCIcount = 0 To CCIPeriod - 1 Begin
MD = MD + Abs(GH[CCIcount] + gL[CCIcount] + GC[CCIcount] - Avgvalue);
End;
MD = MD / CCIPeriod;
If MD == 0 Then
CCIv = 0;
Else
CCIv = (GH + gL + GC - Avgvalue) / (0.015 * MD);
End
Else
CCIv = 0;
//CCI가 0선 보다 큼
if CCIv > 0 then
value = value + 1;
else
value = value - 1;
//CO가 0선 보다 큼
if ema(accum(((gC -gL)-(gH- gC))/ (gH-gL)*V), 3) - ema(accum(((gC -gL)-(gH- gC))/(gH-gL)*V), 10) >=0 then
value = value + 1;
else
value = value - 1;
input : AF(0.02),AFMAX(0.2);
Var : Direction(0), SAR_Value(Close), AF_Value(.02), HighValue(h), LowValue(l), EP(0),Sarv(0);
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);
}
}
//문장7 : 종가가 파라볼릭보다 큼
if Sarv < gC then
value = value + 1;
else
value = value - 1;
BW_SEVEN = value;
var1 = ema(BW_SEVEN,P1)- ema(BW_SEVEN,P2);
var2 = ema(var1,P3);
var3 = var1-var2;
# 매수/매도청산
If CrossUp(value,1) Then{
value87 = H;
value88 = index;
}
if value87 > 0 and index >= value88 and index <= value88+n2 Then
plot1(value87);
# 매도/매수청산
If CrossDown(value,-1) Then{
value97 = H;
value98 = index;
}
if value97 > 0 and index >= value98 and index <= value98+n2 Then
plot1(value97);
즐거운 하루되세요
> 흑수돌 님이 쓴 글입니다.
> 제목 : 수식 문의
> 안녕하세요. 항상 수고해 주셔서 감사드립니다.
설이 얼마 남지 않았습니다.
올해에도 항상 만복이 깃드시기 바랍니다.
---------
아래는 기본 지표에 있는 '세븐바이너리지표'를 갭보정하여
매수,매도가 나올 수 있도록 시스템 수식으로 만든 것입니다.
아래 수식을 바탕으로
매수신호가 나오면 해당캔들의 저점에 점을 찍고 그 점을 n2봉간 옆으로 늘려주고
매도신호가 나오면 해당캔들의 고점에 점을 찍고 그 점을n2봉간 옆으로 늘려주는
지표를 얻고 싶습니다.
감사합니다.
--------아래 --------------
Input: shortPeriod(13), longPeriod(26), Period(6), maPeriod(13), ROCPeriod(9), stoPeriod1(10),
stoPeriod2(6), CCIPeriod(9);
input: P1(13),P2(26),P3(6);
var: value(0),BW_SEVEN(0);
var : sumGap(0), gap(0), GO(0), GH(0), GL(0), GC(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; // 종가에서 갭누적값을 차감
//문장1 : MACD가 MACD 시그널선 보다 큼
if ema(gC,shortPeriod)-ema(gC,longPeriod) >= ema(ema(gC,shortPeriod)-ema(gC,longPeriod),Period) then
value = 1;
else
value = -1;
//문장2 : 종가가 이동평균선보다 큼
if gC >= ma(gC, maPeriod) then
value = value + 1;
else
value = value - 1;
//문장3 : Price ROC가 0선보다 큼
if (gC - gC[ROCPeriod]) / gC[ROCPeriod] * 100 >= 0 then
value = value + 1;
else
value = value - 1;
//문장4 : StochasticsK선이 50선 보다 큼
if ema((gC-lowest(gL, stoPeriod1)) / (highest(gH, stoPeriod1) - lowest(gL, stoPeriod1)) * 100, stoPeriod2)>=50 then
value = value + 1;
else
value = value - 1;
Variables: Sum(0), CCIcount(0), MD(0), Avgvalue(0),CCIV(0);
If CCIPeriod > 0 Then Begin
Avgvalue = Ma(GH + gL + GC, CCIPeriod);
MD = 0;
For CCIcount = 0 To CCIPeriod - 1 Begin
MD = MD + Abs(GH[CCIcount] + gL[CCIcount] + GC[CCIcount] - Avgvalue);
End;
MD = MD / CCIPeriod;
If MD == 0 Then
CCIv = 0;
Else
CCIv = (GH + gL + GC - Avgvalue) / (0.015 * MD);
End
Else
CCIv = 0;
//CCI가 0선 보다 큼
if CCIv > 0 then
value = value + 1;
else
value = value - 1;
//CO가 0선 보다 큼
if ema(accum(((gC -gL)-(gH- gC))/ (gH-gL)*V), 3) - ema(accum(((gC -gL)-(gH- gC))/(gH-gL)*V), 10) >=0 then
value = value + 1;
else
value = value - 1;
input : AF(0.02),AFMAX(0.2);
Var : Direction(0), SAR_Value(Close), AF_Value(.02), HighValue(h), LowValue(l), EP(0),Sarv(0);
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);
}
}
//문장7 : 종가가 파라볼릭보다 큼
if Sarv < gC then
value = value + 1;
else
value = value - 1;
BW_SEVEN = value;
var1 = ema(BW_SEVEN,P1)- ema(BW_SEVEN,P2);
var2 = ema(var1,P3);
var3 = var1-var2;
# 매수/매도청산
If CrossUp(value,1) Then
{
Buy();
}
# 매도/매수청산
If CrossDown(value,-1) Then
{
Sell();
}