커뮤니티
문의드립니다.
2013-11-20 12:23:47
192
글번호 69645
[지표수식]
input : Atime(60),StoPeriod(10), StoPeriod1(6), StoPeriod2(6);
var : count(0), highVal(0), lowVal(0), StoFastK(0), StoK(0), StoD(0);
var : Ep(0), EP1(0), JISU(0), DINDEX(0), PreStoK(0), PreStoD(0),cnt(0);
Array : HH[50](0),LL[50](0);
var1 = TimeToMinutes(stime)%Atime;
if dayindex == 0 or (var1 < var1[1] and stime > stime[1]) Then{
HH[0] = H;
LL[0] = L;
for cnt = 1 to 49{
HH[cnt] = HH[cnt-1][1];
LL[cnt] = LL[cnt-1][1];
}
}
if H > HH[0] Then
HH[0] = H;
if L < LL[0] Then
LL[0] = L;
highVal = HH[0];
lowVal = LL[0];
for count = 0 to StoPeriod-1 {
if HH[count] > highVal then
highVal = HH[count];
if LL[count] < lowVal then
lowVal = LL[count];
}
StoFastK = (C-lowVal)/(highVal-lowVal)*100;
#### Slow StochasticsK ####
Ep = 2/(StoPeriod1+1);
if DINDEX >= StoPeriod and (date != date[1] or var1 < var1[1]) then {
DINDEX = DINDEX + 1;
PreStoK = StoK[1];
}
if DINDEX <= 1 then
StoK = StoFastK ;
else
StoK = StoFastK * EP + PreStoK * (1-EP);
#### Slow StochasticsD ####
Ep1 = 2/(StoPeriod2+1);
if date != date[1] or var1 < var1[1] then {
DINDEX = DINDEX + 1;
PreStoD = StoD[1];
}
if DINDEX <= 1 then
StoD = StoK ;
else
StoD = StoK * EP1 + PreStoD * (1-EP1);
plot1(StoK);
plot2(StoD);
PlotBaseLine1(20);
PlotBaseLine2(80);
위의 지표수식을 참고하여 아래의 수식을 수정하고자 합니다.
신호봉이 지표상의 StoD의 값의 범위에 따라 각각 수익 청산을 적용할려고 합니다.
현재는 강제청산상의 목표수익의 적용을 받아 일괄되게 청산하였지만
수익의 값을 StoD의 값의 범위에 따라 다르게 적용하고자 합니다.
따라서, 매수식만 만들어주시면 매도는 적용해서 넣도록 하겟습니다.
아래의 범위에 해당하지 않는 경우는 기존대로 강제청산상의 목표수익의 적용을 받으면 됩니다.
[신호봉의 StoD 범위 - 조건만족시 수익실현후 청산 - 다음 신호 대기]
90이상 ~ 100이하 수익 2pt
80.5 ~ 81 수익 2pt
75 ~79 수익 2pt
62 ~65 수익 4pt
50.5 ~ 55 수익 5pt
43 ~45 수익 2pt
20 ~ 36.5 수익 2pt
1 ~ 20이하 수익 10pt
[기본수식]
input : BBP(15),dv(2),per(100000000000),per1(10);
var : BBup(0),BBdn(0);
BBup = BollBandUp(BBP,dv);
BBdn = BollBandDown(BBp,Dv);
if C > O Then
var1 = 1;
if (MarketPosition == 0 and var1 == 1 and
((C >= BBdn and BBdn >= O) or (C <= BBdn))) And
(money >= per and (money <= Money[1]*(1+Per1/100))) Then{
var1 = 2;
Buy("매수");
}
답변 1
예스스탁 예스스탁 답변
2013-11-20 15:33:36
안녕하세요
예스스탁입니다.
input : BBP(15),dv(2),per(100000000000),per1(10);
input : Atime(60),StoPeriod(10), StoPeriod1(6), StoPeriod2(6);
var : BBup(0),BBdn(0),value(0);
var : count(0), highVal(0), lowVal(0), StoFastK(0), StoK(0), StoD(0);
var : Ep(0), EP1(0), JISU(0), DINDEX(0), PreStoK(0), PreStoD(0),cnt(0),tf(0);
Array : HH[50](0),LL[50](0);
tf = TimeToMinutes(stime)%Atime;
if dayindex == 0 or (tf < tf[1] and stime > stime[1]) Then{
HH[0] = H;
LL[0] = L;
for cnt = 1 to 49{
HH[cnt] = HH[cnt-1][1];
LL[cnt] = LL[cnt-1][1];
}
}
if H > HH[0] Then
HH[0] = H;
if L < LL[0] Then
LL[0] = L;
highVal = HH[0];
lowVal = LL[0];
for count = 0 to StoPeriod-1 {
if HH[count] > highVal then
highVal = HH[count];
if LL[count] < lowVal then
lowVal = LL[count];
}
StoFastK = (C-lowVal)/(highVal-lowVal)*100;
#### Slow StochasticsK ####
Ep = 2/(StoPeriod1+1);
if DINDEX >= StoPeriod and (date != date[1] or var1 < var1[1]) then {
DINDEX = DINDEX + 1;
PreStoK = StoK[1];
}
if DINDEX <= 1 then
StoK = StoFastK ;
else
StoK = StoFastK * EP + PreStoK * (1-EP);
#### Slow StochasticsD ####
Ep1 = 2/(StoPeriod2+1);
if date != date[1] or var1 < var1[1] then {
DINDEX = DINDEX + 1;
PreStoD = StoD[1];
}
if DINDEX <= 1 then
StoD = StoK ;
else
StoD = StoK * EP1 + PreStoD * (1-EP1);
BBup = BollBandUp(BBP,dv);
BBdn = BollBandDown(BBp,Dv);
if C > O Then
var1 = 1;
if (MarketPosition == 0 and var1 == 1 and
((C >= BBdn and BBdn >= O) or (C <= BBdn))) And
(money >= per and (money <= Money[1]*(1+Per1/100))) Then{
var1 = 2;
Buy("매수");
}
if MarketPosition == 1 Then{
value = stod[BarsSinceEntry];
if 100 >= value and value >= 90 Then
exitlong("bx1",Atlimit,EntryPrice+2);
else if 81 >= value and value >= 80.5 Then
exitlong("bx2",Atlimit,EntryPrice+2);
else if 79 >= value and value >= 75 Then
exitlong("bx3",Atlimit,EntryPrice+2);
else if 65 >= value and value >= 62 Then
exitlong("bx4",Atlimit,EntryPrice+4);
else if 55 >= value and value >= 50.5 Then
exitlong("bx5",Atlimit,EntryPrice+5);
else if 45 >= value and value >= 43 Then
exitlong("bx6",Atlimit,EntryPrice+2);
else if 36.5 >= value and value >= 20 Then
exitlong("bx7",Atlimit,EntryPrice+2);
else if 20 >= value and value >= 1 Then
exitlong("bx8",Atlimit,EntryPrice+10);
else #위 조건이 모두 아닐때
exitlong("bx9",Atlimit,EntryPrice+3);
}
조건을 나눠 목표수익을 산정하므로
기존의 목표수익 청산식은 사용하시면 안되고
위와 같이 지정한 조건이 아닐때의 청산도
같이 처리해 주셔야 합니다.
즐거운 하루되세요
> 깡통불기 님이 쓴 글입니다.
> 제목 : 문의드립니다.
> [지표수식]
input : Atime(60),StoPeriod(10), StoPeriod1(6), StoPeriod2(6);
var : count(0), highVal(0), lowVal(0), StoFastK(0), StoK(0), StoD(0);
var : Ep(0), EP1(0), JISU(0), DINDEX(0), PreStoK(0), PreStoD(0),cnt(0);
Array : HH[50](0),LL[50](0);
var1 = TimeToMinutes(stime)%Atime;
if dayindex == 0 or (var1 < var1[1] and stime > stime[1]) Then{
HH[0] = H;
LL[0] = L;
for cnt = 1 to 49{
HH[cnt] = HH[cnt-1][1];
LL[cnt] = LL[cnt-1][1];
}
}
if H > HH[0] Then
HH[0] = H;
if L < LL[0] Then
LL[0] = L;
highVal = HH[0];
lowVal = LL[0];
for count = 0 to StoPeriod-1 {
if HH[count] > highVal then
highVal = HH[count];
if LL[count] < lowVal then
lowVal = LL[count];
}
StoFastK = (C-lowVal)/(highVal-lowVal)*100;
#### Slow StochasticsK ####
Ep = 2/(StoPeriod1+1);
if DINDEX >= StoPeriod and (date != date[1] or var1 < var1[1]) then {
DINDEX = DINDEX + 1;
PreStoK = StoK[1];
}
if DINDEX <= 1 then
StoK = StoFastK ;
else
StoK = StoFastK * EP + PreStoK * (1-EP);
#### Slow StochasticsD ####
Ep1 = 2/(StoPeriod2+1);
if date != date[1] or var1 < var1[1] then {
DINDEX = DINDEX + 1;
PreStoD = StoD[1];
}
if DINDEX <= 1 then
StoD = StoK ;
else
StoD = StoK * EP1 + PreStoD * (1-EP1);
plot1(StoK);
plot2(StoD);
PlotBaseLine1(20);
PlotBaseLine2(80);
위의 지표수식을 참고하여 아래의 수식을 수정하고자 합니다.
신호봉이 지표상의 StoD의 값의 범위에 따라 각각 수익 청산을 적용할려고 합니다.
현재는 강제청산상의 목표수익의 적용을 받아 일괄되게 청산하였지만
수익의 값을 StoD의 값의 범위에 따라 다르게 적용하고자 합니다.
따라서, 매수식만 만들어주시면 매도는 적용해서 넣도록 하겟습니다.
아래의 범위에 해당하지 않는 경우는 기존대로 강제청산상의 목표수익의 적용을 받으면 됩니다.
[신호봉의 StoD 범위 - 조건만족시 수익실현후 청산 - 다음 신호 대기]
90이상 ~ 100이하 수익 2pt
80.5 ~ 81 수익 2pt
75 ~79 수익 2pt
62 ~65 수익 4pt
50.5 ~ 55 수익 5pt
43 ~45 수익 2pt
20 ~ 36.5 수익 2pt
1 ~ 20이하 수익 10pt
[기본수식]
input : BBP(15),dv(2),per(100000000000),per1(10);
var : BBup(0),BBdn(0);
BBup = BollBandUp(BBP,dv);
BBdn = BollBandDown(BBp,Dv);
if C > O Then
var1 = 1;
if (MarketPosition == 0 and var1 == 1 and
((C >= BBdn and BBdn >= O) or (C <= BBdn))) And
(money >= per and (money <= Money[1]*(1+Per1/100))) Then{
var1 = 2;
Buy("매수");
}