커뮤니티
수식 부탁드립니다.
2017-01-25 21:30:08
140
글번호 106296
항상 감사드립니다.
1. 전일종가가 상한가 or 스토케스틱 전일 종가지표가 0(Zero)였으면
첫번째 Stok CrossUp(Stok지표 10)시 진입 금지, 2번째 Crossup(Stok지표 10)부터는 매수 진입
2. 현재 봉 기준 3시간(입력 변수적용_선언시 3시간) 이전의 최저가 대비 최고가가 5%(입력변수 적용)이상이면 매수 진입 금지, 5%이하시 매수 진입
현재 봉 기준 3시간(입력 변수적용_선언시 3시간) 이전의 최저종가 대비 최고종가 5%(입력변수 적용)이상이면 매수 진입 금지, 5%이하시 매수 진입
3. 진입가 대비 -5%이상(변수적용) 손실이고, 진입 날짜 대비 3일 경과(진입일부터 1)시 손절
답변 1
예스스탁 예스스탁 답변
2017-01-26 10:44:22
안녕하세요
예스스탁입니다.
1
var : 상한가(0), UpLimit(0);
var : up1(0), up2(0), up3(0), up4(0), up5(0),up6(0),Up7(0);
var : stok(0),count(0);
if date >= 19981207 then {
if date < 20050328 && CodeCategory() == 2 then
UpLimit = (BP[0] * 1.12);
Else if date >= 20050328 and date < 20150615 Then
UpLimit = (BP[0] * 1.15);
Else
UpLimit = (BP[0] * 1.30);
if CodeCategory() == 2 then {
if date >= 20030721 then {
up1 = int(UpLimit/100+0.00001)*100;
up2 = int(UpLimit/100+0.00001)*100;
up3 = int(UpLimit/100+0.00001)*100;
up4 = int(UpLimit/50+0.00001)*50;
up5 = int(UpLimit/10+0.00001)*10;
up6 = int(UpLimit/5+0.00001)*5;
up7 = int(UpLimit/1+0.00001)*1;
}
else {
up1 = int(UpLimit/1000+0.00001)*1000;
up2 = int(UpLimit/500+0.00001)*500;
up3 = int(UpLimit/100+0.00001)*100;
up4 = int(UpLimit/50+0.00001)*50;
up5 = int(UpLimit/10+0.00001)*10;
up6 = int(UpLimit/10+0.00001)*10;
up7 = int(UpLimit/1+0.00001)*1;
}
}
Else {
up1 = int(UpLimit/1000+0.00001)*1000;
up2 = int(UpLimit/500+0.00001)*500;
up3 = int(UpLimit/100+0.00001)*100;
up4 = int(UpLimit/50+0.00001)*50;
up5 = int(UpLimit/10+0.00001)*10;
up6 = int(UpLimit/5+0.00001)*5;
up7 = int(UpLimit/1+0.00001)*1;
}
if CodeCategory() == 1 || CodeCategory() == 2 then {
if sdate < 20101004 Then{
If BP >= 500000 Then
상한가 = up1;
Else If BP >= 100000 Then
상한가 = iff(up2>=500000, up1, up2);
Else If BP >= 50000 Then
상한가 = iff(up3>=100000, up2, up3);
Else If BP >= 10000 Then
상한가 = iff(up4>=50000, up3, up4);
Else If BP >= 5000 Then
상한가 = iff(up5>=10000, up4, up5);
Else If BP >= 1000 Then
상한가 = iff(up5>=5000, up5, up6);
Else
상한가 = iff(up6>=1000, up6, up6);
}
Else{
If BP >= 500000 Then
상한가 = up1;
Else If BP >= 100000 Then
상한가 = iff(up2>=500000, up1, up2);
Else If BP >= 50000 Then
상한가 = iff(up3>=100000, up2, up3);
Else If BP >= 10000 Then
상한가 = iff(up4>=50000, up3, up4);
Else If BP >= 5000 Then
상한가 = iff(up5>=10000, up4, up5);
Else If BP >= 1000 Then
상한가 = iff(up5>=5000, up5, up6);
Else
상한가 = iff(up6>=1000, up6, up7);
}
}
else if CodeCategory() == 8 || CodeCategory() == 9 then { // ETF
상한가 = up6;
}
}
stok = Stochasticsk(10,5);
if date != date[1] Then{
count = 0;
Condition1 = false;
if DayClose(1) >= 상한가 or stok[1] == 0 Then
Condition1 = true;
}
if crossup(stok,10) Then{
count = count+1;
if Condition1 == false and count >= 1 Then
buy();
if Condition1 == true and count >= 2 Then
buy();
}
2-1
input : 분(180);
var : TM(0),T1(0),cnt(0),HH(0),LL(0),idx(0);
TM = TimeToMinutes(stime);
if date != date[1] Then{
T1 = TM;
HH = H;
LL = L;
idx = 0;
}
if date == date then
idx = idx+1;
if TM < T1+분 Then{
if H > HH Then
HH = H;
if L < LL Then
LL = L;
}
Else{
HH = H;
LL = L;
for cnt = 0 to idx{
if TM[cnt] > TM-분 and H[cnt] > HH Then
HH = H[cnt];
if TM[cnt] > TM-분 and L[cnt] < LL Then
LL = L[cnt];
}
}
if HH <= LL*1.05 Then
buy();
2-2
input : 분(180);
var : TM(0),T1(0),cnt(0),HH(0),LL(0),idx(0);
TM = TimeToMinutes(stime);
if date != date[1] Then{
T1 = TM;
HH = C;
LL = C;
idx = 0;
}
if date == date then
idx = idx+1;
if TM < T1+분 Then{
if C > HH Then
HH = C;
if C < LL Then
LL = C;
}
Else{
HH = C;
LL = C;
for cnt = 0 to idx{
if TM[cnt] > TM-분 and C[cnt] > HH Then
HH = C[cnt];
if TM[cnt] > TM-분 and C[cnt] < LL Then
LL = C[cnt];
}
}
if HH <= LL*1.05 Then
buy();
3
input : LossPer(5);
var : DD(0);
if date != date[1] Then
dd = dd+1;
if MarketPosition == 1 and DD >= DD[BarsSinceEntry]+2 and
C <= EntryPrice*(1-LossPer/100) Then
exitlong();
즐거운 명절 되시길 바랍니다.
> 자동매매를알자 님이 쓴 글입니다.
> 제목 : 수식 부탁드립니다.
> 항상 감사드립니다.
1. 전일종가가 상한가 or 스토케스틱 전일 종가지표가 0(Zero)였으면
첫번째 Stok CrossUp(Stok지표 10)시 진입 금지, 2번째 Crossup(Stok지표 10)부터는 매수 진입
2. 현재 봉 기준 3시간(입력 변수적용_선언시 3시간) 이전의 최저가 대비 최고가가 5%(입력변수 적용)이상이면 매수 진입 금지, 5%이하시 매수 진입
현재 봉 기준 3시간(입력 변수적용_선언시 3시간) 이전의 최저종가 대비 최고종가 5%(입력변수 적용)이상이면 매수 진입 금지, 5%이하시 매수 진입
3. 진입가 대비 -5%이상(변수적용) 손실이고, 진입 날짜 대비 3일 경과(진입일부터 1)시 손절