커뮤니티
질문드립니다~
2011-05-12 09:29:29
532
글번호 38516
일반종목 차트의 분봉에다가 걸어놓고 매매하는 식인데요.
여기에다가
일봉상 전일종가대비 당일시가가 2%~5% 사이일때만
아래식의 1차 매수가 일어나게 하고 싶습니다.
수식은 분봉에다가 걸어놓을꺼구요.
1차매수가 일봉상 전일종가대비 당일시가가 2~5%일때 작동하게 하고 싶습니다.
2차매수와 3차매수는 상관없습니다.
그리고 1차매수시간을 09~14시 까지안에서만 일어나게 하는 수식을 넣고 싶습니다.
input : P1(10),Capital(3000000);
var : sumv(0),count(0),mav(0),EntryP(0);
Condition1 = date==exitdate(1) And MarketPosition(1) == 1;
#진입수량
if CodeCategory == 1 Then{
if BasePrice < 50000 Then{
Var1 = int(int((Capital*0.1)/C)/10)*10;
Var2 = int(int((Capital*0.2)/C)/10)*10;
Var3 = int(int((Capital*0.7)/C)/10)*10;
}
Else{
Var1 = int((Capital*0.1)/C);
Var2 = int((Capital*0.2)/C);
Var3 = int((Capital*0.7)/C);
}
}
if CodeCategory == 2 Then{
Var1 = int((Capital*0.1)/C);
Var2 = int((Capital*0.2)/C);
Var3 = int((Capital*0.7)/C);
}
#일봉이평
sumV = 0;
for count = 1 to p1-1 {
sumV = sumV+DayClose(count);
}
maV = (sumV+dayopen()) / p1;
#1차매수
if condition1 == false Then{
if MarketPosition == 0 and L <=mav and H >= mav Then
buy("b1",OnClose,def,var1);
}
if MarketPosition == 1 Then{
#매수후 분할수량계산
if CurrentContracts > CurrentContracts[1] Then{
EntryP = C[1];
if CodeCategory == 1 Then{
value1 = int(int((CurrentContracts*0.5)/10)*10);
value2 = CurrentContracts-value1;
}
if CodeCategory == 2 Then{
value1 = int(CurrentContracts*0.5);
value2 = CurrentContracts-value1;
}
}
#2차매수
if CurrentEntries == 1 and CrossDown(c,EntryPrice*0.97) then
buy("b2",OnClose,def,var2);
#3차매수
if CurrentEntries == 2 and CrossDown(c,EntryPrice*0.95) then
buy("b3",OnClose,def,var3);
#1차매수 후 청산
if MaxEntries == 1 Then{
if CurrentContracts == MaxContracts Then
ExitLong("bx1_1",AtLimit,EntryPrice*1.05,"",value1,1);
if CurrentContracts < MaxContracts Then{
ExitLong("bx1_2",AtLimit,EntryPrice*1.10,"",value2,1);
ExitLong("bx1_3",AtStop,EntryPrice*1.02);
}
}
#2차매수 후 청산
if MaxEntries == 2 Then{
if CurrentContracts == MaxContracts Then
ExitLong("bx2_1",AtLimit,EntryP*1.07,"",value1,1);
if CurrentContracts < MaxContracts Then{
ExitLong("bx2_2",AtLimit,EntryP*1.12,"",value2,1);
ExitLong("bx2_3",AtStop,EntryP*1.05);
}
}
#3차매수 후 청산
if MaxEntries == 3 Then{
if CurrentContracts == MaxContracts Then
ExitLong("bx3_1",AtLimit,EntryP*1.05,"",value1,1);
if CurrentContracts < MaxContracts Then{
ExitLong("bx3_2",AtLimit,EntryP*1.10,"",value2,1);
ExitLong("bx3_3",AtStop,EntryP*1.04);
}
}
#손절
exitlong("loss",AtStop,EntryPrice*0.90);
}
답변 1
예스스탁 예스스탁 답변
2011-05-12 15:59:23
안녕하세요
예스스탁입니다.
input : P1(10),Capital(3000000);
var : sumv(0),count(0),mav(0),EntryP(0);
Condition1 = date==exitdate(1) And MarketPosition(1) == 1;
#진입수량
if CodeCategory == 1 Then{
if BasePrice < 50000 Then{
Var1 = int(int((Capital*0.1)/C)/10)*10;
Var2 = int(int((Capital*0.2)/C)/10)*10;
Var3 = int(int((Capital*0.7)/C)/10)*10;
}
Else{
Var1 = int((Capital*0.1)/C);
Var2 = int((Capital*0.2)/C);
Var3 = int((Capital*0.7)/C);
}
}
if CodeCategory == 2 Then{
Var1 = int((Capital*0.1)/C);
Var2 = int((Capital*0.2)/C);
Var3 = int((Capital*0.7)/C);
}
#일봉이평
sumV = 0;
for count = 1 to p1-1 {
sumV = sumV+DayClose(count);
}
maV = (sumV+dayopen()) / p1;
#1차매수
if condition1 == false Then{
if MarketPosition == 0 and L <=mav and H >= mav and dayOpen>=DayClose(1)*1.02 and dayOpen<=DayClose(1)*1.05 Then
buy("b1",OnClose,def,var1);
}
if MarketPosition == 1 Then{
#매수후 분할수량계산
if CurrentContracts > CurrentContracts[1] Then{
EntryP = C[1];
if CodeCategory == 1 Then{
value1 = int(int((CurrentContracts*0.5)/10)*10);
value2 = CurrentContracts-value1;
}
if CodeCategory == 2 Then{
value1 = int(CurrentContracts*0.5);
value2 = CurrentContracts-value1;
}
}
#2차매수
if CurrentEntries == 1 and CrossDown(c,EntryPrice*0.97) then
buy("b2",OnClose,def,var2);
#3차매수
if CurrentEntries == 2 and CrossDown(c,EntryPrice*0.95) then
buy("b3",OnClose,def,var3);
#1차매수 후 청산
if MaxEntries == 1 Then{
if CurrentContracts == MaxContracts Then
ExitLong("bx1_1",AtLimit,EntryPrice*1.05,"",value1,1);
if CurrentContracts < MaxContracts Then{
ExitLong("bx1_2",AtLimit,EntryPrice*1.10,"",value2,1);
ExitLong("bx1_3",AtStop,EntryPrice*1.02);
}
}
#2차매수 후 청산
if MaxEntries == 2 Then{
if CurrentContracts == MaxContracts Then
ExitLong("bx2_1",AtLimit,EntryP*1.07,"",value1,1);
if CurrentContracts < MaxContracts Then{
ExitLong("bx2_2",AtLimit,EntryP*1.12,"",value2,1);
ExitLong("bx2_3",AtStop,EntryP*1.05);
}
}
#3차매수 후 청산
if MaxEntries == 3 Then{
if CurrentContracts == MaxContracts Then
ExitLong("bx3_1",AtLimit,EntryP*1.05,"",value1,1);
if CurrentContracts < MaxContracts Then{
ExitLong("bx3_2",AtLimit,EntryP*1.10,"",value2,1);
ExitLong("bx3_3",AtStop,EntryP*1.04);
}
}
#손절
exitlong("loss",AtStop,EntryPrice*0.90);
}
즐거운 하루되세요
> 부자청년28 님이 쓴 글입니다.
> 제목 : 질문드립니다~
> 일반종목 차트의 분봉에다가 걸어놓고 매매하는 식인데요.
여기에다가
일봉상 전일종가대비 당일시가가 2%~5% 사이일때만
아래식의 1차 매수가 일어나게 하고 싶습니다.
수식은 분봉에다가 걸어놓을꺼구요.
1차매수가 일봉상 전일종가대비 당일시가가 2~5%일때 작동하게 하고 싶습니다.
2차매수와 3차매수는 상관없습니다.
그리고 1차매수시간을 09~14시 까지안에서만 일어나게 하는 수식을 넣고 싶습니다.
input : P1(10),Capital(3000000);
var : sumv(0),count(0),mav(0),EntryP(0);
Condition1 = date==exitdate(1) And MarketPosition(1) == 1;
#진입수량
if CodeCategory == 1 Then{
if BasePrice < 50000 Then{
Var1 = int(int((Capital*0.1)/C)/10)*10;
Var2 = int(int((Capital*0.2)/C)/10)*10;
Var3 = int(int((Capital*0.7)/C)/10)*10;
}
Else{
Var1 = int((Capital*0.1)/C);
Var2 = int((Capital*0.2)/C);
Var3 = int((Capital*0.7)/C);
}
}
if CodeCategory == 2 Then{
Var1 = int((Capital*0.1)/C);
Var2 = int((Capital*0.2)/C);
Var3 = int((Capital*0.7)/C);
}
#일봉이평
sumV = 0;
for count = 1 to p1-1 {
sumV = sumV+DayClose(count);
}
maV = (sumV+dayopen()) / p1;
#1차매수
if condition1 == false Then{
if MarketPosition == 0 and L <=mav and H >= mav Then
buy("b1",OnClose,def,var1);
}
if MarketPosition == 1 Then{
#매수후 분할수량계산
if CurrentContracts > CurrentContracts[1] Then{
EntryP = C[1];
if CodeCategory == 1 Then{
value1 = int(int((CurrentContracts*0.5)/10)*10);
value2 = CurrentContracts-value1;
}
if CodeCategory == 2 Then{
value1 = int(CurrentContracts*0.5);
value2 = CurrentContracts-value1;
}
}
#2차매수
if CurrentEntries == 1 and CrossDown(c,EntryPrice*0.97) then
buy("b2",OnClose,def,var2);
#3차매수
if CurrentEntries == 2 and CrossDown(c,EntryPrice*0.95) then
buy("b3",OnClose,def,var3);
#1차매수 후 청산
if MaxEntries == 1 Then{
if CurrentContracts == MaxContracts Then
ExitLong("bx1_1",AtLimit,EntryPrice*1.05,"",value1,1);
if CurrentContracts < MaxContracts Then{
ExitLong("bx1_2",AtLimit,EntryPrice*1.10,"",value2,1);
ExitLong("bx1_3",AtStop,EntryPrice*1.02);
}
}
#2차매수 후 청산
if MaxEntries == 2 Then{
if CurrentContracts == MaxContracts Then
ExitLong("bx2_1",AtLimit,EntryP*1.07,"",value1,1);
if CurrentContracts < MaxContracts Then{
ExitLong("bx2_2",AtLimit,EntryP*1.12,"",value2,1);
ExitLong("bx2_3",AtStop,EntryP*1.05);
}
}
#3차매수 후 청산
if MaxEntries == 3 Then{
if CurrentContracts == MaxContracts Then
ExitLong("bx3_1",AtLimit,EntryP*1.05,"",value1,1);
if CurrentContracts < MaxContracts Then{
ExitLong("bx3_2",AtLimit,EntryP*1.10,"",value2,1);
ExitLong("bx3_3",AtStop,EntryP*1.04);
}
}
#손절
exitlong("loss",AtStop,EntryPrice*0.90);
}
다음글
이전글