커뮤니티
질문드립니다.
2011-05-07 09:14:02
694
글번호 38389
지금의 식에서 당일 매도가 단한번이라도 일어나면
1차든 2차든 3차든 당일에 재매수가 안일어나게 하고 싶습니다.
input : P1(10),ACCOUNT(1000000);
var : cnt(0),sumV(0), maV(0), count(0), chk_price(0);
sumV = 0;
for count = 1 to p1-1 {
sumV = sumV+DayClose(count);
}
maV = (sumV+dayopen()) / p1;
value1 = account*0.1;
value2 = account*0.1;
value3 = account*0.8;
if CodeCategory == 1 Then{
if MarketPosition == 0 and L <=mav and H >= mav Then
buy("거래소매수1", onclose, def, int(int(value1/C)/10)*10);
if MarketPosition == 1 and Highest(CurrentContracts,BarsSinceEntry) == CurrentContracts then{
if CurrentEntries == 1 and C <= chk_price*0.9 Then
buy("거래소매수2", OnClose, def, int(int(value2/C)/10)*10);
if CurrentEntries == 2 and C <= chk_price*0.9 Then
buy("거래소매수3", OnClose, def, int(int(value2/C)/10)*10);
}
}
if CodeCategory == 2 Then{
if MarketPosition == 0 and L <=mav and H >= mav then
buy("코스닥매수1", onclose, def, int(Value1/C));
if MarketPosition == 1 and Highest(CurrentContracts,BarsSinceEntry) == CurrentContracts then{
if CurrentEntries == 1 and C <= chk_price*0.9 Then
buy("코스닥매수2", OnClose,DEF,int(Value2/C));
if CurrentEntries == 2 and C <= chk_price*0.9 Then
buy("코스닥매수3", OnClose,DEF,int(Value2/C));
}
}
if MarketPosition == 1 Then{
if CurrentEntries > CurrentEntries[1] Then{
chk_price = C[1];
if CodeCategory == 1 Then{
var1 = CurrentContracts;
var2 = int(int(var1*0.5/10)*10);
var3 = var1 - var2;
}
if CodeCategory == 2 Then{
var1 = CurrentContracts;
var2 = int(var1*0.5);
var3 = var1 - var2;
}
}
if CurrentContracts == var1 Then # 1차청산
exitlong("bx1",AtLimit,chk_price*1.03,"",var2,1);
if CurrentContracts == var3 Then # 2차청산
exitlong("bx2",AtLimit,chk_price*1.08,"",var3,1);
}
답변 1
예스스탁 예스스탁 답변
2011-05-09 10:09:04
안녕하세요? 예스스탁입니다.
문의하신 내용 답변드립니다.
input : P1(10),ACCOUNT(1000000);
var : cnt(0),sumV(0), maV(0), count(0), chk_price(0);
Condition1 = date==exitdate(1) And MarketPosition(1) == 1;
sumV = 0;
for count = 1 to p1-1 {
sumV = sumV+DayClose(count);
}
maV = (sumV+dayopen()) / p1;
value1 = account*0.1;
value2 = account*0.1;
value3 = account*0.8;
if CodeCategory == 1 and condition1 == false Then{
if MarketPosition == 0 and L <=mav and H >= mav Then
buy("거래소매수1", onclose, def, int(int(value1/C)/10)*10);
if MarketPosition == 1 and Highest(CurrentContracts,BarsSinceEntry) == CurrentContracts then{
if CurrentEntries == 1 and C <= chk_price*0.9 Then
buy("거래소매수2", OnClose, def, int(int(value2/C)/10)*10);
if CurrentEntries == 2 and C <= chk_price*0.9 Then
buy("거래소매수3", OnClose, def, int(int(value2/C)/10)*10);
}
}
if CodeCategory == 2 and condition1 == false Then{
if MarketPosition == 0 and L <=mav and H >= mav then
buy("코스닥매수1", onclose, def, int(Value1/C));
if MarketPosition == 1 and Highest(CurrentContracts,BarsSinceEntry) == CurrentContracts then{
if CurrentEntries == 1 and C <= chk_price*0.9 Then
buy("코스닥매수2", OnClose,DEF,int(Value2/C));
if CurrentEntries == 2 and C <= chk_price*0.9 Then
buy("코스닥매수3", OnClose,DEF,int(Value2/C));
}
}
if MarketPosition == 1 Then{
if CurrentEntries > CurrentEntries[1] Then{
chk_price = C[1];
if CodeCategory == 1 Then{
var1 = CurrentContracts;
var2 = int(int(var1*0.5/10)*10);
var3 = var1 - var2;
}
if CodeCategory == 2 Then{
var1 = CurrentContracts;
var2 = int(var1*0.5);
var3 = var1 - var2;
}
}
if CurrentContracts == var1 Then # 1차청산
exitlong("bx1",AtLimit,chk_price*1.03,"",var2,1);
if CurrentContracts == var3 Then # 2차청산
exitlong("bx2",AtLimit,chk_price*1.08,"",var3,1);
}
> 부자청년28 님이 쓴 글입니다.
> 제목 : 질문드립니다.
> 지금의 식에서 당일 매도가 단한번이라도 일어나면
1차든 2차든 3차든 당일에 재매수가 안일어나게 하고 싶습니다.
input : P1(10),ACCOUNT(1000000);
var : cnt(0),sumV(0), maV(0), count(0), chk_price(0);
sumV = 0;
for count = 1 to p1-1 {
sumV = sumV+DayClose(count);
}
maV = (sumV+dayopen()) / p1;
value1 = account*0.1;
value2 = account*0.1;
value3 = account*0.8;
if CodeCategory == 1 Then{
if MarketPosition == 0 and L <=mav and H >= mav Then
buy("거래소매수1", onclose, def, int(int(value1/C)/10)*10);
if MarketPosition == 1 and Highest(CurrentContracts,BarsSinceEntry) == CurrentContracts then{
if CurrentEntries == 1 and C <= chk_price*0.9 Then
buy("거래소매수2", OnClose, def, int(int(value2/C)/10)*10);
if CurrentEntries == 2 and C <= chk_price*0.9 Then
buy("거래소매수3", OnClose, def, int(int(value2/C)/10)*10);
}
}
if CodeCategory == 2 Then{
if MarketPosition == 0 and L <=mav and H >= mav then
buy("코스닥매수1", onclose, def, int(Value1/C));
if MarketPosition == 1 and Highest(CurrentContracts,BarsSinceEntry) == CurrentContracts then{
if CurrentEntries == 1 and C <= chk_price*0.9 Then
buy("코스닥매수2", OnClose,DEF,int(Value2/C));
if CurrentEntries == 2 and C <= chk_price*0.9 Then
buy("코스닥매수3", OnClose,DEF,int(Value2/C));
}
}
if MarketPosition == 1 Then{
if CurrentEntries > CurrentEntries[1] Then{
chk_price = C[1];
if CodeCategory == 1 Then{
var1 = CurrentContracts;
var2 = int(int(var1*0.5/10)*10);
var3 = var1 - var2;
}
if CodeCategory == 2 Then{
var1 = CurrentContracts;
var2 = int(var1*0.5);
var3 = var1 - var2;
}
}
if CurrentContracts == var1 Then # 1차청산
exitlong("bx1",AtLimit,chk_price*1.03,"",var2,1);
if CurrentContracts == var3 Then # 2차청산
exitlong("bx2",AtLimit,chk_price*1.08,"",var3,1);
}