커뮤니티
글번호 45392번 재질문
2015-12-08 21:30:40
108
글번호 93208
안녕하세요?
글번호 45392번 답변 감사드립니다.
매수뿐만 아니라 매도에 대한 부분도 변경 부탁드립니다.
Bdate 개념이 아닌 time 개념으로 추가 수정 부탁드립니다.
답변 1
예스스탁 예스스탁 답변
2015-12-09 11:30:34
안녕하세요
예스스탁입니다.
시간으로 변경했습니다.
추가로 일간 시가,고가,저가도 지정한 시간을 기준으로
계산되게 수정했습니다.
input : starttime(70000),xtime(060000);
var : TF(0);
var : Etime(false),cnt(0),mav1(0),mav2(0);
var : HV(0),LV(0),HV1(0),LV1(0),HV2(0),LV2(0);
Array : HH[50](0),LL[50](0),CC[50](0);
mav1 = ma(c,5);
mav2 = ma(C,20);
TF = TimeToMinutes(stime)%30;
if stime == starttime or (stime > starttime and stime[1] < starttime) Then{
Etime = false;
}
if stime == xtime or (stime > xtime and stime[1] < xtime) Then{
Etime = true;
}
if (stime == starttime or (stime > starttime and stime[1] < starttime)) 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];
CC[cnt] = CC[cnt-1][1];
}
}
if H > HH[0] Then
HH[0] = H;
if L < LL[0] Then
LL[0] = L;
CC[0] = C;
if HH[25+2] > 0 Then{
HV = HH[0];
LV = LL[0];
HV1 = HH[1];
LV1 = LL[1];
HV2 = HH[2];
LV2 = LL[2];
for cnt = 0 to 25{
if HH[cnt] > HV Then
HV = HH[cnt];
if LL[cnt] < LV Then
LV = LL[cnt];
if HH[cnt+1] > HV Then
HV = HH[cnt+1];
if LL[cnt+1] < LV Then
LV = LL[cnt+1];
if HH[cnt+2] > HV Then
HV = HH[cnt+2];
if LL[cnt+2] < LV Then
LV = LL[cnt+2];
}
var1 = (HV+LV)/2;
var2 = (HV1+LV1)/2;
var3 = (HV2+LV2)/2;
if Etime == true then{
if MarketPosition == 0 and CC[0] > var1 and CC[1] < var2 and CC[2] < var3 and C >= daylow+0.5 Then
buy("b",AtMarket);
if MarketPosition == 1 and c <= highest(H,BarsSinceEntry)-0.5 and CrossDown(mav1,mav2) Then
ExitLong("bx",AtMarket);
}
}
if stime == Xtime or (stime > Xtime and stime[1] < Xtime) Then{
Etime = false;
ExitLong();
}
var : entry1(0);
var : ho1(0),OL1(0),HL1(0);
var : maho1(0),maOL1(0),maHL1(0);
var : cnt1(0),sumho1(0),sumOL1(0),sumHL1(0);
var : EntryCnt1(0);
var : V1(0),V2(0),V3(0),V4(0),V5(0);
var : V6(0),V7(0),V8(0),V9(0),V10(0);
Array : DO[20](0),DH[20](0),DL[20](0);
if stime == starttime or (stime > starttime and stime[1] < starttime) Then{
entry1 = 0;
DO[0] = O;
DH[0] = H;
DL[0] = L;
for cnt = 0 to 19{
DO[cnt] = DO[cnt-1][1];
DH[cnt] = DH[cnt-1][1];
DL[cnt] = DL[cnt-1][1];
}
}
if H > DH[0] Then
DH[0] = H;
if L < DL[0] Then
DL[0] = L;
if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then
entry1 = entry1+1;
ho1 = DH[0]-DO[0];
OL1 = DO[0]-DL[0];
HL1 = DH[0]-DL[0];
sumho1 = 0;
sumOL1 = 0;
sumHL1 = 0;
if DO[10] > 0 then{
for cnt1 = 1 to 10{
sumho1 = sumho1 + (DH[cnt1]-DO[cnt1]);
sumOL1 = sumOL1 + (DO[cnt1]-DL[cnt1]);
sumHL1 = sumHL1 + (DH[cnt1]-DL[cnt1]);
}
maho1 = sumho1/10;
maOL1 = sumOL1/10;
maHL1 = sumHL1/10;
V1 = DO[0]+maho1;
V2 = DO[0]-maOL1;
V3 = DO[0]+maHL1;
V4 = DO[0]-maHL1;
V5 = NthMaxList(1,V1,V2,V3,V4);
V6 = NthMaxList(2,V1,V2,V3,V4);
V9 = NthMaxList(3,V1,V2,V3,V4);
V10 = NthMaxList(4,V1,V2,V3,V4);
V7 = (V5+V10)/2;
V8 = (V6+V9)/2;
if MarketPosition == 0 and entry1 == 0 Then{
if V7 > V8 Then
sell("s1",AtStop,V7);
if V7 < V8 Then
sell("s2",Atlimit,V8);
}
if MarketPosition == -1 and IsEntryName("s1") == true Then{
ExitShort("sp1",atlimit,V9);
ExitShort("sl1",AtStop,V6);
}
if MarketPosition == -1 and IsEntryName("s2") == true Then{
ExitShort("sp2",atlimit,V9-0.03);
ExitShort("sl2",AtStop,V6);
}
}
즐거운 하루되세요
> 통큰베팅 님이 쓴 글입니다.
> 제목 : 글번호 45392번 재질문
> 안녕하세요?
글번호 45392번 답변 감사드립니다.
매수뿐만 아니라 매도에 대한 부분도 변경 부탁드립니다.
Bdate 개념이 아닌 time 개념으로 추가 수정 부탁드립니다.
다음글
이전글