커뮤니티

수식 변경 부탁드립니다

프로필 이미지
뽄때
2014-05-17 11:06:30
157
글번호 75155
답변완료
지난번에 타분봉 즉 60분봉을 참조해서 매매할 수 있도록 수식을 수정해주셔서 잘 사용하고 있습니다. 또 한 번 부탁드리고 싶은것은 아래의 식에서 일봉의 스톡케스틱도 참조를 하고 싶습니다. 즉 매수조건에서 일봉의 %k가 %D보다 클때(%K > %D)매수하는 조건을 추가하고 싶은데요...(매매하는 기준 봉은 7분봉이며, 지난번에 60분봉의 %K값이 60이상일때 매수하도록 수정해 주셨음) 일봉이 360분봉이니까 360분봉을 참조하도록 하면 되지 않을까 생각이 드는데요.. 수식좀 부탁드립니다 ==================================================================================== Input : Period(25), Period1(6), Period2(6), MAP(5),투입금액1(1100000),투입금액2(2100000); input : Atime(60),StoPeriod(25), StoPeriod1(6), StoPeriod2(6);//타분봉(Atime) 스토케스틱 var : StoK(0),StoD(0),vol1(0),vol2(0),mav(0),SH(0),cross(0),Dncnt(0); Var : Lvalue(0), Hvalue(0),FK(0),BuySetup(true),ExitSetup1(false),ExitSetup2(false); var : cnt(0),TF(0),Hvalue1(0), Lvalue1(0),sum1(0),sum2(0); Array : HH[50](0),LL[50](0),FK1[50](0),SK1[50](0),SD1[50](0); #kospi if CodeCategory == 1 Then{ if BasePrice < 50000 Then{ vol1 = int(int(투입금액1/C)/10)*10; vol2 = int(int(투입금액2/C)/10)*10; } Else{ vol1 = int(투입금액1/C); vol2 = int(투입금액2/C); } } #kosdoq if CodeCategory == 2 Then{ vol1 = int(투입금액1/C); vol2 = int(투입금액2/C); } #option if CodeCategory == 6 or CodeCategory == 8 Then{ vol1 = int((투입금액1)/(C*BigPointValue)); vol2 = int((투입금액2)/(C*BigPointValue)); } Lvalue = Lowest(L, Period); Hvalue = Highest(H, Period); #차트의 스토케스틱 FK = (Close - Lvalue) / (Hvalue - Lvalue) * 100; StoK = ma(FK,Period1); StoD = ma(StoK,Period2); mav = ma(C,MAP); #타분봉 스토케스틱 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]; FK1[cnt] = FK1[cnt-1][1]; SK1[cnt] = SK1[cnt-1][1]; SD1[cnt] = SD1[cnt-1][1]; } } if H > HH[0] Then HH[0] = H; if L < LL[0] Then LL[0] = L; if HH[StoPeriod] > 0 Then{ Hvalue1 = HH[0]; Lvalue1 = LL[0]; for cnt = 0 to StoPeriod-1 { if HH[cnt] > Hvalue1 then Hvalue1 = HH[cnt]; if LL[cnt] < Lvalue1 then Lvalue1 = LL[cnt]; } FK1[0] = (C-Lvalue1)/(Hvalue1-Lvalue1)*100; } if FK1[StoPeriod1] > 0 Then{ sum1 = 0; for cnt = 0 to StoPeriod1-1{ sum1 = sum1+FK1[cnt]; } SK1[0] = sum1/StoPeriod1; } if SK1[StoPeriod2] > 0 Then{ sum2 = 0; for cnt = 0 to StoPeriod2-1{ sum2 = sum2+SK1[cnt]; } SD1[0] = sum2/StoPeriod2; } #%k가 25을 하향돌파하면 BuySetup은 true if BuySetup == false and CrossDown(stok,25) Then{ BuySetup = true; } #%k가 60이상 상승하면 BuySetup은 false if Stok >= 60 Then BuySetup = false; #날짜와 시간 설정 if sdate > 20140228 and stime > 090000 Then Condition1 = true; #BuySetup이 true일때 if BuySetup == true Then{ if Condition1 == true and crossup(stok,stod) and stok[1] < stod[1] and MarketPosition == 0 and SK1[0] > 60 Then buy("매수",OnClose,def,vol1); }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2014-05-19 13:35:19

안녕하세요 예스스탁입니다. Input : Period(25), Period1(6), Period2(6), MAP(5),투입금액1(1100000),투입금액2(2100000); input : Atime(60),StoPeriod(25), StoPeriod1(6), StoPeriod2(6);//타분봉(Atime) 스토케스틱 var : StoK(0),StoD(0),vol1(0),vol2(0),mav(0),SH(0),cross(0),Dncnt(0); Var : Lvalue(0), Hvalue(0),FK(0),BuySetup(true),ExitSetup1(false),ExitSetup2(false); var : cnt(0),TF(0),Hvalue1(0), Lvalue1(0),sum1(0),sum2(0); var : dhighVal(0), dlowVal(0), dFK(0), dSK(0), dSD(0); var : dEp1(0), dEp2(0),dPreSK(0), dPreSD(0); Array : HH[50](0),LL[50](0),FK1[50](0),SK1[50](0),SD1[50](0); #일봉 스토케스틱 #N일간 최고가 및 최저가 dhighVal = dayhigh(0); dlowVal = daylow(0); for cnt = 0 to Period-1 { if dayHigh(cnt) > dhighVal then dhighVal = dayhigh(cnt); if dayLow(cnt) < dlowVal then dlowVal = dayLow(cnt); } #Fast StochasticsK dFK = (C-dlowVal)/(dhighVal-dlowVal)*100; #Slow StochasticsK / Slow StochasticsD dEp1 = 2/(Period1+1); dEp2 = 2/(Period2+1); if date != date[1] then { dPreSK = dSK[1]; dPreSD = dSD[1]; } dSK = dFK * dEP1 + dPreSK * (1-dEP1); dSD = dSK * dEP2 + dPreSD * (1-dEP2); #kospi if CodeCategory == 1 Then{ if BasePrice < 50000 Then{ vol1 = int(int(투입금액1/C)/10)*10; vol2 = int(int(투입금액2/C)/10)*10; } Else{ vol1 = int(투입금액1/C); vol2 = int(투입금액2/C); } } #kosdoq if CodeCategory == 2 Then{ vol1 = int(투입금액1/C); vol2 = int(투입금액2/C); } #option if CodeCategory == 6 or CodeCategory == 8 Then{ vol1 = int((투입금액1)/(C*BigPointValue)); vol2 = int((투입금액2)/(C*BigPointValue)); } Lvalue = Lowest(L, Period); Hvalue = Highest(H, Period); #차트의 스토케스틱 FK = (Close - Lvalue) / (Hvalue - Lvalue) * 100; StoK = ma(FK,Period1); StoD = ma(StoK,Period2); mav = ma(C,MAP); #타분봉 스토케스틱 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]; FK1[cnt] = FK1[cnt-1][1]; SK1[cnt] = SK1[cnt-1][1]; SD1[cnt] = SD1[cnt-1][1]; } } if H > HH[0] Then HH[0] = H; if L < LL[0] Then LL[0] = L; if HH[StoPeriod] > 0 Then{ Hvalue1 = HH[0]; Lvalue1 = LL[0]; for cnt = 0 to StoPeriod-1 { if HH[cnt] > Hvalue1 then Hvalue1 = HH[cnt]; if LL[cnt] < Lvalue1 then Lvalue1 = LL[cnt]; } FK1[0] = (C-Lvalue1)/(Hvalue1-Lvalue1)*100; } if FK1[StoPeriod1] > 0 Then{ sum1 = 0; for cnt = 0 to StoPeriod1-1{ sum1 = sum1+FK1[cnt]; } SK1[0] = sum1/StoPeriod1; } if SK1[StoPeriod2] > 0 Then{ sum2 = 0; for cnt = 0 to StoPeriod2-1{ sum2 = sum2+SK1[cnt]; } SD1[0] = sum2/StoPeriod2; } #%k가 25을 하향돌파하면 BuySetup은 true if BuySetup == false and CrossDown(stok,25) Then{ BuySetup = true; } #%k가 60이상 상승하면 BuySetup은 false if Stok >= 60 Then BuySetup = false; #날짜와 시간 설정 if sdate > 20140228 and stime > 090000 Then Condition1 = true; #BuySetup이 true일때 if BuySetup == true Then{ if Condition1 == true and crossup(stok,stod) and stok[1] < stod[1] and MarketPosition == 0 and SK1[0] > 60 And dSK > dSD Then buy("매수",OnClose,def,vol1); } 즐거운 하루되세요 > 뽄때 님이 쓴 글입니다. > 제목 : 수식 변경 부탁드립니다 > 지난번에 타분봉 즉 60분봉을 참조해서 매매할 수 있도록 수식을 수정해주셔서 잘 사용하고 있습니다. 또 한 번 부탁드리고 싶은것은 아래의 식에서 일봉의 스톡케스틱도 참조를 하고 싶습니다. 즉 매수조건에서 일봉의 %k가 %D보다 클때(%K > %D)매수하는 조건을 추가하고 싶은데요...(매매하는 기준 봉은 7분봉이며, 지난번에 60분봉의 %K값이 60이상일때 매수하도록 수정해 주셨음) 일봉이 360분봉이니까 360분봉을 참조하도록 하면 되지 않을까 생각이 드는데요.. 수식좀 부탁드립니다 ==================================================================================== Input : Period(25), Period1(6), Period2(6), MAP(5),투입금액1(1100000),투입금액2(2100000); input : Atime(60),StoPeriod(25), StoPeriod1(6), StoPeriod2(6);//타분봉(Atime) 스토케스틱 var : StoK(0),StoD(0),vol1(0),vol2(0),mav(0),SH(0),cross(0),Dncnt(0); Var : Lvalue(0), Hvalue(0),FK(0),BuySetup(true),ExitSetup1(false),ExitSetup2(false); var : cnt(0),TF(0),Hvalue1(0), Lvalue1(0),sum1(0),sum2(0); Array : HH[50](0),LL[50](0),FK1[50](0),SK1[50](0),SD1[50](0); #kospi if CodeCategory == 1 Then{ if BasePrice < 50000 Then{ vol1 = int(int(투입금액1/C)/10)*10; vol2 = int(int(투입금액2/C)/10)*10; } Else{ vol1 = int(투입금액1/C); vol2 = int(투입금액2/C); } } #kosdoq if CodeCategory == 2 Then{ vol1 = int(투입금액1/C); vol2 = int(투입금액2/C); } #option if CodeCategory == 6 or CodeCategory == 8 Then{ vol1 = int((투입금액1)/(C*BigPointValue)); vol2 = int((투입금액2)/(C*BigPointValue)); } Lvalue = Lowest(L, Period); Hvalue = Highest(H, Period); #차트의 스토케스틱 FK = (Close - Lvalue) / (Hvalue - Lvalue) * 100; StoK = ma(FK,Period1); StoD = ma(StoK,Period2); mav = ma(C,MAP); #타분봉 스토케스틱 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]; FK1[cnt] = FK1[cnt-1][1]; SK1[cnt] = SK1[cnt-1][1]; SD1[cnt] = SD1[cnt-1][1]; } } if H > HH[0] Then HH[0] = H; if L < LL[0] Then LL[0] = L; if HH[StoPeriod] > 0 Then{ Hvalue1 = HH[0]; Lvalue1 = LL[0]; for cnt = 0 to StoPeriod-1 { if HH[cnt] > Hvalue1 then Hvalue1 = HH[cnt]; if LL[cnt] < Lvalue1 then Lvalue1 = LL[cnt]; } FK1[0] = (C-Lvalue1)/(Hvalue1-Lvalue1)*100; } if FK1[StoPeriod1] > 0 Then{ sum1 = 0; for cnt = 0 to StoPeriod1-1{ sum1 = sum1+FK1[cnt]; } SK1[0] = sum1/StoPeriod1; } if SK1[StoPeriod2] > 0 Then{ sum2 = 0; for cnt = 0 to StoPeriod2-1{ sum2 = sum2+SK1[cnt]; } SD1[0] = sum2/StoPeriod2; } #%k가 25을 하향돌파하면 BuySetup은 true if BuySetup == false and CrossDown(stok,25) Then{ BuySetup = true; } #%k가 60이상 상승하면 BuySetup은 false if Stok >= 60 Then BuySetup = false; #날짜와 시간 설정 if sdate > 20140228 and stime > 090000 Then Condition1 = true; #BuySetup이 true일때 if BuySetup == true Then{ if Condition1 == true and crossup(stok,stod) and stok[1] < stod[1] and MarketPosition == 0 and SK1[0] > 60 Then buy("매수",OnClose,def,vol1); }