커뮤니티
수정부탁드려요
2013-05-20 15:59:35
281
글번호 63360
수고하시네요
앞전에 짜주신 수식에서 수정 부탁드립니다
input : 일봉볼밴기간(12),Atime(60), StoPeriod(30), StoPeriod1(5), StoPeriod2(5);
input : TStoPeriod(30), TStoPeriod1(8), TStoPeriod2(8);
var : daycnt(0),daysum(0),dayma(0),Predaysum(0),Predayma(0);
var : cnt(0),count(0),sum(0),mav(0),Presum(0),Premav(0),TT(0),stok(-1),stod(-1);
var : highVal(0), lowVal(0), StoFastK(0),T(0),Tstok(0),Tstod(0);
var : Ep(0), EP1(0), JISU(0), DINDEX(0), PreStoK(0), PreStoD(0);
Array : CC[100](0),HH[50](0),LL[50](0);
daysum = 0;
Predaysum = 0;
for daycnt = 0 to 일봉볼밴기간-1{
daysum = daysum + DayClose(daycnt);
Predaysum = Predaysum + DayClose(daycnt+1);
}
dayma = daysum/일봉볼밴기간;
Predayma = Predaysum/일봉볼밴기간;
T = TimeToMinutes(stime)%Atime;
if dayindex == 0 or (T < T[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 cnt = 0 to StoPeriod-1 {
if HH[cnt] > highVal then
highVal = HH[cnt];
if LL[cnt] < lowVal then
lowVal = LL[cnt];
}
StoFastK = (C-lowVal)/(highVal-lowVal)*100;
#### Slow StochasticsK ####
Ep = 2/(StoPeriod1+1);
if DINDEX >= StoPeriod and (date != date[1] or T < T[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 T < T[1] then {
DINDEX = DINDEX + 1;
PreStoD = StoD[1];
}
if DINDEX <= 1 then
StoD = StoK ;
else
StoD = StoK * EP1 + PreStoD * (1-EP1);
Tstok = StochasticsK(TstoPeriod,TstoPeriod1);
Tstod = StochasticsD(TstoPeriod,TstoPeriod1,TstoPeriod2);
if dayma > 0 and Predayma > 0 and StoK > -1 and StoD > -1 and
C > dayma and dayma > predayma and
SToK > 20 and
crossup(Tstok,10) Then
buy();
if MarketPosition == 1 Then{
if CrossUp(Tstok,80) Then
exitlong();
if CrossDown(Tstok,10) Then
ExitLong();
}
if dayma > 0 and Predayma > 0 and StoK > -1 and StoD > -1 and
C < dayma and dayma < predayma and
SToK < 80 and
CrossDown(Tstok,90) Then
Sell();
if MarketPosition == -1 Then{
if CrossDown(stok,20) Then
ExitShort();
if CrossUp(stok,90) Then
ExitShort();
}
앞전에 수식 짜주신 부분에서
매도
60분봉에서 스톡 k선이 기준선 80 하락하고
틱봉 화면에서 스톡 기준선 90 하락시 매도인데
그림에서 보면 60분봉에서 80 하락이 아니고 앞에 기준선을 20 돌파 한 상태인데도
틱봉화면에서 매도가 발생 했습니다
수정 부탁드리구요
매수 조건에서도 살펴봐주시기 바래요
답변 1
예스스탁 예스스탁 답변
2013-05-20 21:46:14
안녕하세요
예스스탁입니다.
작성해 드린식에서 분봉의 스토케스틱선을 계산하는 부분은 해당 식 내용이 최선입니다.
틱봉자체에서 분봉과 같은 봉의 시고저종값을 추출할수 없으므로
계산식 내용은 따로 보강할 방법이 없습니다.
현재 작성한 식에
매수식은 분봉값이 20이상인 상태에서 틱봉에서 10을 상향돌파하면매수
매도식은 분봉값이 80이하인 상태에서 틱봉에서 90을 상향이탈하면매도하게 작성이 되어 있습니다.
동시 돌파이시면 진입식 내용을 아래와 같이 변경하시면 됩니다.
if dayma > 0 and Predayma > 0 and StoK > -1 and StoD > -1 and
C > dayma and dayma > predayma and
crossup(SToK,20) and
crossup(Tstok,10) Then
buy();
if MarketPosition == 1 Then{
if CrossUp(Tstok,80) Then
exitlong();
if CrossDown(Tstok,10) Then
ExitLong();
}
if dayma > 0 and Predayma > 0 and StoK > -1 and StoD > -1 and
C < dayma and dayma < predayma and
CrossDown(SToK,80) and
CrossDown(Tstok,90) Then
Sell();
if MarketPosition == -1 Then{
if CrossDown(stok,20) Then
ExitShort();
if CrossUp(stok,90) Then
ExitShort();
}
즐거운 하루되세요
> 내가제일 님이 쓴 글입니다.
> 제목 : 수정부탁드려요
> 수고하시네요
앞전에 짜주신 수식에서 수정 부탁드립니다
input : 일봉볼밴기간(12),Atime(60), StoPeriod(30), StoPeriod1(5), StoPeriod2(5);
input : TStoPeriod(30), TStoPeriod1(8), TStoPeriod2(8);
var : daycnt(0),daysum(0),dayma(0),Predaysum(0),Predayma(0);
var : cnt(0),count(0),sum(0),mav(0),Presum(0),Premav(0),TT(0),stok(-1),stod(-1);
var : highVal(0), lowVal(0), StoFastK(0),T(0),Tstok(0),Tstod(0);
var : Ep(0), EP1(0), JISU(0), DINDEX(0), PreStoK(0), PreStoD(0);
Array : CC[100](0),HH[50](0),LL[50](0);
daysum = 0;
Predaysum = 0;
for daycnt = 0 to 일봉볼밴기간-1{
daysum = daysum + DayClose(daycnt);
Predaysum = Predaysum + DayClose(daycnt+1);
}
dayma = daysum/일봉볼밴기간;
Predayma = Predaysum/일봉볼밴기간;
T = TimeToMinutes(stime)%Atime;
if dayindex == 0 or (T < T[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 cnt = 0 to StoPeriod-1 {
if HH[cnt] > highVal then
highVal = HH[cnt];
if LL[cnt] < lowVal then
lowVal = LL[cnt];
}
StoFastK = (C-lowVal)/(highVal-lowVal)*100;
#### Slow StochasticsK ####
Ep = 2/(StoPeriod1+1);
if DINDEX >= StoPeriod and (date != date[1] or T < T[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 T < T[1] then {
DINDEX = DINDEX + 1;
PreStoD = StoD[1];
}
if DINDEX <= 1 then
StoD = StoK ;
else
StoD = StoK * EP1 + PreStoD * (1-EP1);
Tstok = StochasticsK(TstoPeriod,TstoPeriod1);
Tstod = StochasticsD(TstoPeriod,TstoPeriod1,TstoPeriod2);
if dayma > 0 and Predayma > 0 and StoK > -1 and StoD > -1 and
C > dayma and dayma > predayma and
SToK > 20 and
crossup(Tstok,10) Then
buy();
if MarketPosition == 1 Then{
if CrossUp(Tstok,80) Then
exitlong();
if CrossDown(Tstok,10) Then
ExitLong();
}
if dayma > 0 and Predayma > 0 and StoK > -1 and StoD > -1 and
C < dayma and dayma < predayma and
SToK < 80 and
CrossDown(Tstok,90) Then
Sell();
if MarketPosition == -1 Then{
if CrossDown(stok,20) Then
ExitShort();
if CrossUp(stok,90) Then
ExitShort();
}
앞전에 수식 짜주신 부분에서
매도
60분봉에서 스톡 k선이 기준선 80 하락하고
틱봉 화면에서 스톡 기준선 90 하락시 매도인데
그림에서 보면 60분봉에서 80 하락이 아니고 앞에 기준선을 20 돌파 한 상태인데도
틱봉화면에서 매도가 발생 했습니다
수정 부탁드리구요
매수 조건에서도 살펴봐주시기 바래요
다음글
이전글