커뮤니티
수정 and 추가바랍니다
2012-01-05 06:30:26
376
글번호 46310
아래 수식에서 수정할부분을 아래와 같이 수정바라며
평균매수가대비 수익률이 3%, 5% ,8% 지점에서 3분할매도하는수식에서
평균매수가대비 3%지점을 돌파후 다시 그지점을 이탈 즉시 전량매도
평균매수가대비 5%지점을 돌파후 다시 그지점을 이탈 즉시 전량매도
수정된 전체 수식에
#1과 #2를 각각 따로 적용바랍니다.
#1
현재 매수조건에서
지정가격에서 1번 매수되면 다시 그 매수조건이 와도 재매수되지 않도록 해주세요
청산1.2차를 통하여 매도를 하는경우에도 지정가격에서 재매수를 금지 바랍니다
청산 1.2차매도가 아닌 수익실현을통한 매도인경우에만 다시 해당조건에 매수가 가능해야함.
#2
청산 1.2차 매도가 아닌 수익 실현 매도를 하는
당일에는 매수금지하는 수식
input : 최고점(20000),최저점(10000),시작날짜(20111216);
var : 중간값(0),매수1차(0),매수2차(0),매수3차(0),청산1차(0),청산2차(0);
중간값 = (최고점+최저점)/2;
매수1차 = (최고점+중간값)/2;
매수2차 = 중간값;
매수3차 = (중간값+최저점)/2;
청산1차 = (매수1차+중간값)/2;
청산2차 = (중간값+매수3차)/2;
Condition1 = IsExitName("bx8",1) or IsExitName("bx9",1);
if sdate >= 시작날짜 Then{
if MarketPosition == 0 or (MarketPosition == 1 and C < EntryPrice) Then{
if L > 매수1차 and Condition1 == False Then
buy("b1",AtStop,매수1차);
if L > 매수2차 and Condition1 == False Then
buy("b2",AtStop,매수2차);
if L > 매수3차 and Condition1 == False then
buy("b3",AtStop,매수3차);
}
if MarketPosition == 1 Then{
if CurrentEntries == MaxEntries and MaxEntries == 2 Then
exitlong("bx1",atlimit,청산1차,"B1");
if CurrentEntries == MaxEntries and MaxEntries == 3 Then
exitlong("bx2",atlimit,청산2차,"B1");
if CurrentEntries == MaxEntries and MaxEntries == 3 Then
exitlong("bx3",atlimit,청산2차,"B2");
}
////////////////////// 수정 ///////////////////////////////
if MarketPosition == 1 Then{
exitlong("bx4",atlimit,AvgEntryPrice*1.03,"",int(CurrentContracts*0.5),1);
exitlong("bx5",atlimit,AvgEntryPrice*1.05);
///////////////////////////////////////////////////////
if crossup(C, AvgEntryPrice) Then{
Condition1 = true;
var1 = index;
}
if Condition1 == true Then{
exitlong("bx6",AtStop,highest(H,index-var1+1)*0.99,"",int(CurrentContracts*0.5),1);
exitlong("bx7",AtStop,highest(H,index-var1+1)*0.97);
}
exitlong("bx8",AtStop,최저점);
exitlong("bx9",AtStop,AvgEntryPrice*0.95);
}
}
답변 1
예스스탁 예스스탁 답변
2012-01-05 14:12:46
안녕하세요
예스스탁입니다.
1.
input : 최고점(20000),최저점(10000),시작날짜(20111216);
var : 중간값(0),매수1차(0),매수2차(0),매수3차(0),청산1차(0),청산2차(0),count(0),cnt(0);
중간값 = (최고점+최저점)/2;
매수1차 = (최고점+중간값)/2;
매수2차 = 중간값;
매수3차 = (중간값+최저점)/2;
청산1차 = (매수1차+중간값)/2;
청산2차 = (중간값+매수3차)/2;
Condition1 = IsExitName("bx8",1) or IsExitName("bx9",1);
count == 0;
for cnt = 0 to 10{
if sdate == EntryDate(cnt) Then
count = count+1;
}
Condition2 = count == 0 or
(count >= 1 and
IsExitName("bx1",1) == false and
IsExitName("bx2",1) == false and
IsExitName("bx3",1) == false);
if sdate >= 시작날짜 Then{
if (MarketPosition == 0 and (Condition2 == true) or (MarketPosition == 1 and C < EntryPrice)) Then{
if L > 매수1차 and Condition1 == False Then
buy("b1",AtStop,매수1차);
if L > 매수2차 and Condition1 == False Then
buy("b2",AtStop,매수2차);
if L > 매수3차 and Condition1 == False then
buy("b3",AtStop,매수3차);
}
if MarketPosition == 1 Then{
if CurrentEntries == MaxEntries and MaxEntries == 2 Then
exitlong("bx1",atlimit,청산1차,"B1");
if CurrentEntries == MaxEntries and MaxEntries == 3 Then
exitlong("bx2",atlimit,청산2차,"B1");
if CurrentEntries == MaxEntries and MaxEntries == 3 Then
exitlong("bx3",atlimit,청산2차,"B2");
}
////////////////////// 수정 ///////////////////////////////
if MarketPosition == 1 Then{
if countif(highest(h,BarsSinceEntry) < AvgEntryPrice*1.03,CurrentEntries) < 1 Then
ExitLong("xx1",atlimit,AvgEntryPrice*1.03);
if countif(highest(h,BarsSinceEntry) < AvgEntryPrice*1.05,CurrentEntries) < 1 Then
ExitLong("xx2",atlimit,AvgEntryPrice*1.05);
if countif(highest(h,BarsSinceEntry) < AvgEntryPrice*1.08,CurrentEntries) < 1 Then
ExitLong("xx3",atlimit,AvgEntryPrice*1.08);
if countif(highest(h,BarsSinceEntry) >= AvgEntryPrice*1.03,CurrentEntries) >= 1 Then
ExitLong("xx11",AtStop,AvgEntryPrice*1.03);
if countif(highest(h,BarsSinceEntry) >= AvgEntryPrice*1.05,CurrentEntries) >= 1 Then
ExitLong("xx21",AtStop,AvgEntryPrice*1.05);
///////////////////////////////////////////////////////
if crossup(C, AvgEntryPrice) Then{
Condition1 = true;
var1 = index;
}
if Condition1 == true Then{
exitlong("bx6",AtStop,highest(H,index-var1+1)*0.99,"",int(CurrentContracts*0.5),1);
exitlong("bx7",AtStop,highest(H,index-var1+1)*0.97);
}
exitlong("bx8",AtStop,최저점);
exitlong("bx9",AtStop,AvgEntryPrice*0.95);
}
}
2.
input : 최고점(20000),최저점(10000),시작날짜(20111216);
var : 중간값(0),매수1차(0),매수2차(0),매수3차(0),청산1차(0),청산2차(0),count(0),cnt(0);
중간값 = (최고점+최저점)/2;
매수1차 = (최고점+중간값)/2;
매수2차 = 중간값;
매수3차 = (중간값+최저점)/2;
청산1차 = (매수1차+중간값)/2;
청산2차 = (중간값+매수3차)/2;
Condition1 = IsExitName("bx8",1) or IsExitName("bx9",1);
count == 0;
for cnt = 0 to 10{
if sdate == EntryDate(cnt) Then
count = count+1;
}
Condition2 = count == 0 or
(count >= 1 and ExitDate(1) == sdate and
(IsExitName("xx1",1) == true or
IsExitName("xx2",1) == true or
IsExitName("xx3",1) == true or
IsExitName("xx11",1) == true or
IsExitName("xx21",1) == true));
if sdate >= 시작날짜 Then{
if (MarketPosition == 0 and (Condition2 == false) or (MarketPosition == 1 and C < EntryPrice)) Then{
if L > 매수1차 and Condition1 == False Then
buy("b1",AtStop,매수1차);
if L > 매수2차 and Condition1 == False Then
buy("b2",AtStop,매수2차);
if L > 매수3차 and Condition1 == False then
buy("b3",AtStop,매수3차);
}
if MarketPosition == 1 Then{
if CurrentEntries == MaxEntries and MaxEntries == 2 Then
exitlong("bx1",atlimit,청산1차,"B1");
if CurrentEntries == MaxEntries and MaxEntries == 3 Then
exitlong("bx2",atlimit,청산2차,"B1");
if CurrentEntries == MaxEntries and MaxEntries == 3 Then
exitlong("bx3",atlimit,청산2차,"B2");
}
////////////////////// 수정 ///////////////////////////////
if MarketPosition == 1 Then{
if countif(highest(h,BarsSinceEntry) < AvgEntryPrice*1.03,CurrentEntries) < 1 Then
ExitLong("xx1",atlimit,AvgEntryPrice*1.03);
if countif(highest(h,BarsSinceEntry) < AvgEntryPrice*1.05,CurrentEntries) < 1 Then
ExitLong("xx2",atlimit,AvgEntryPrice*1.05);
if countif(highest(h,BarsSinceEntry) < AvgEntryPrice*1.08,CurrentEntries) < 1 Then
ExitLong("xx3",atlimit,AvgEntryPrice*1.08);
if countif(highest(h,BarsSinceEntry) >= AvgEntryPrice*1.03,CurrentEntries) >= 1 Then
ExitLong("xx11",AtStop,AvgEntryPrice*1.03);
if countif(highest(h,BarsSinceEntry) >= AvgEntryPrice*1.05,CurrentEntries) >= 1 Then
ExitLong("xx21",AtStop,AvgEntryPrice*1.05);
///////////////////////////////////////////////////////
if crossup(C, AvgEntryPrice) Then{
Condition1 = true;
var1 = index;
}
if Condition1 == true Then{
exitlong("bx6",AtStop,highest(H,index-var1+1)*0.99,"",int(CurrentContracts*0.5),1);
exitlong("bx7",AtStop,highest(H,index-var1+1)*0.97);
}
exitlong("bx8",AtStop,최저점);
exitlong("bx9",AtStop,AvgEntryPrice*0.95);
}
}
즐거운 하루되세요
> 쭈니오빠 님이 쓴 글입니다.
> 제목 : 수정 and 추가바랍니다
> 아래 수식에서 수정할부분을 아래와 같이 수정바라며
평균매수가대비 수익률이 3%, 5% ,8% 지점에서 3분할매도하는수식에서
평균매수가대비 3%지점을 돌파후 다시 그지점을 이탈 즉시 전량매도
평균매수가대비 5%지점을 돌파후 다시 그지점을 이탈 즉시 전량매도
수정된 전체 수식에
#1과 #2를 각각 따로 적용바랍니다.
#1
현재 매수조건에서
지정가격에서 1번 매수되면 다시 그 매수조건이 와도 재매수되지 않도록 해주세요
청산1.2차를 통하여 매도를 하는경우에도 지정가격에서 재매수를 금지 바랍니다
청산 1.2차매도가 아닌 수익실현을통한 매도인경우에만 다시 해당조건에 매수가 가능해야함.
#2
청산 1.2차 매도가 아닌 수익 실현 매도를 하는
당일에는 매수금지하는 수식
input : 최고점(20000),최저점(10000),시작날짜(20111216);
var : 중간값(0),매수1차(0),매수2차(0),매수3차(0),청산1차(0),청산2차(0);
중간값 = (최고점+최저점)/2;
매수1차 = (최고점+중간값)/2;
매수2차 = 중간값;
매수3차 = (중간값+최저점)/2;
청산1차 = (매수1차+중간값)/2;
청산2차 = (중간값+매수3차)/2;
Condition1 = IsExitName("bx8",1) or IsExitName("bx9",1);
if sdate >= 시작날짜 Then{
if MarketPosition == 0 or (MarketPosition == 1 and C < EntryPrice) Then{
if L > 매수1차 and Condition1 == False Then
buy("b1",AtStop,매수1차);
if L > 매수2차 and Condition1 == False Then
buy("b2",AtStop,매수2차);
if L > 매수3차 and Condition1 == False then
buy("b3",AtStop,매수3차);
}
if MarketPosition == 1 Then{
if CurrentEntries == MaxEntries and MaxEntries == 2 Then
exitlong("bx1",atlimit,청산1차,"B1");
if CurrentEntries == MaxEntries and MaxEntries == 3 Then
exitlong("bx2",atlimit,청산2차,"B1");
if CurrentEntries == MaxEntries and MaxEntries == 3 Then
exitlong("bx3",atlimit,청산2차,"B2");
}
////////////////////// 수정 ///////////////////////////////
if MarketPosition == 1 Then{
exitlong("bx4",atlimit,AvgEntryPrice*1.03,"",int(CurrentContracts*0.5),1);
exitlong("bx5",atlimit,AvgEntryPrice*1.05);
///////////////////////////////////////////////////////
if crossup(C, AvgEntryPrice) Then{
Condition1 = true;
var1 = index;
}
if Condition1 == true Then{
exitlong("bx6",AtStop,highest(H,index-var1+1)*0.99,"",int(CurrentContracts*0.5),1);
exitlong("bx7",AtStop,highest(H,index-var1+1)*0.97);
}
exitlong("bx8",AtStop,최저점);
exitlong("bx9",AtStop,AvgEntryPrice*0.95);
}
}