커뮤니티
수식수정 부탁드립니다.
2018-06-29 08:19:20
165
글번호 120162
1)
분할매도가 마무리되어 물량이 0 이 되는날에
그당일은 다시 1차든 2차든 재매수가 안일어났으면 합니다.
2)
지금식은 1차분할매수하고 2차매수가
1차매수후 시간의 흐름에 따라 매도가 한번도 안일어났을때만되는거 같은데요
2차매수는
1차매수후 매도가 몇번이든 발생한 것과 상관없이
예를들어 1차매수후 "매도 1-2" 일어난후에
매수2차가격까지 오면 매수2차매수가 일어났으면 좋겠구요
1차매수부터의 시간의 흐름으로 진행한걸로 매도가 일어났으면 좋겠습니다.
예를들어 1차매수가 발생하고 "매도1-1" "매도1-2"가 진행되다가 주가가 떨어져서
매수2차가에 와서 매수2차가 발생되면 그후에는
매수1차와 2차가 합쳐져서 "매도 1-3"에서 매도가 일어나는 식으루요.
결국 매도는 "매도1-8" 전량 매도가 되어 물량이 0이 되게 하고 싶습니다.
3)
이게 불가능한거면
2차매수가 된시점부터 8분할 매도가 진행되어도 상관없습니다.
감사합니다.
input : 투자금액(1000000),투자비율1(50),투자비율2(50);
var : m1(0),m2(0),dd(0);
m1 = 투자금액*(투자비율1/100);
m2 = 투자금액*(투자비율2/100);
if bdate != bdate[1] Then
{
dd = dd+1;
Condition1 = false;
}
if MarketPosition == 0 and Condition1 == false and DayHigh < DayClose(1)*1.08 Then
{
buy("매수1",atlimit,DayClose(1)*0.985,Floor(m1/(c*0.985)));
}
if MarketPosition == 1 Then
{
if CurrentContracts < CurrentContracts[1] Then
Condition1 = true;
if CurrentContracts > CurrentContracts[1] and MaxEntries == 1 Then
var1 = dd;
if MaxEntries == 1 and Condition1 == false Then
buy("매수2",atlimit,DayClose(1)*0.955,Floor(m2/(c*0.955)));
if EntryTime < 92000 Then
{
if dd == var1 and stime >= 93500 and stime[1] < 93500 Then
ExitLong("매도 1-1",OnClose,def,"",Floor(CurrentContracts*0.12),1);
if dd == var1 and stime >= 103000 and stime[1] < 103000 Then
ExitLong("매도 1-2",OnClose,def,"",Floor(CurrentContracts*0.14),1);
if dd == var1 and stime >= 110000 and stime[1] < 110000 Then
ExitLong("매도 1-3",OnClose,def,"",Floor(CurrentContracts*0.16),1);
if dd == var1 and stime >= 134000 and stime[1] < 134000 Then
ExitLong("매도 1-4",OnClose,def,"",Floor(CurrentContracts*0.20),1);
if dd == var1 and stime >= 143000 and stime[1] < 143000 Then
ExitLong("매도 1-5",OnClose,def,"",Floor(CurrentContracts*0.25),1);
if dd == var1+1 and stime >= 93000 and stime[1] < 93000 Then
ExitLong("매도 1-6",OnClose,def,"",Floor(CurrentContracts*0.33),1);
if dd == var1+1 and stime >= 94300 and stime[1] < 94300 Then
ExitLong("매도 1-7",OnClose,def,"",Floor(CurrentContracts*0.50),1);
if dd == var1+1 and stime >= 105000 and stime[1] < 105000 Then
ExitLong("매도 1-8");
}
if EntryTime >= 92000 and EntryTime < 110000 Then
{
if dd == var1 and stime >= 110000 and stime[1] < 110000 Then
ExitLong("매도2-1",OnClose,def,"",Floor(CurrentContracts*0.12),1);
if dd == var1 and stime >= 134000 and stime[1] < 134000 Then
ExitLong("매도2-2",OnClose,def,"",Floor(CurrentContracts*0.14),1);
if dd == var1 and stime >= 143000 and stime[1] < 143000 Then
ExitLong("매도2-3",OnClose,def,"",Floor(CurrentContracts*0.16),1);
if dd == var1+1 and stime >= 93500 and stime[1] < 93500 Then
ExitLong("매도2-4",OnClose,def,"",Floor(CurrentContracts*0.20),1);
if dd == var1+1 and stime >= 103000 and stime[1] < 103000 Then
ExitLong("매도2-5",OnClose,def,"",Floor(CurrentContracts*0.25),1);
if dd == var1+1 and stime >= 110000 and stime[1] < 110000 Then
ExitLong("매도2-6",OnClose,def,"",Floor(CurrentContracts*0.33),1);
if dd == var1+1 and stime >= 134000 and stime[1] < 134000 Then
ExitLong("매도2-7",OnClose,def,"",Floor(CurrentContracts*0.50),1);
if dd == var1+1 and stime >= 143000 and stime[1] < 143000 Then
ExitLong("매도2-8");
}
if EntryTime >= 110000 and EntryTime < 143000 Then
{
if dd == var1 and stime >= 143000 and stime[1] < 143000 Then
ExitLong("매도3-1",OnClose,def,"",Floor(CurrentContracts*0.14),1);
if dd == var1+1 and stime >= 93500 and stime[1] < 93500 Then
ExitLong("매도3-2",OnClose,def,"",Floor(CurrentContracts*0.16),1);
if dd == var1+1 and stime >= 103000 and stime[1] < 103000 Then
ExitLong("매도3-3",OnClose,def,"",Floor(CurrentContracts*0.20),1);
if dd == var1+1 and stime >= 110000 and stime[1] < 110000 Then
ExitLong("매도3-4",OnClose,def,"",Floor(CurrentContracts*0.25),1);
if dd == var1+1 and stime >= 134000 and stime[1] < 134000 Then
ExitLong("매도3-5",OnClose,def,"",Floor(CurrentContracts*0.33),1);
if dd == var1+1 and stime >= 143000 and stime[1] < 143000 Then
ExitLong("매도3-6",OnClose,def,"",Floor(CurrentContracts*0.50),1);
if dd == var1+2 and stime >= 93500 and stime[1] < 93500 Then
ExitLong("매도3-7");
}
if EntryTime >= 143000 Then
{
if dd == var1+1 and stime >= 93500 and stime[1] < 93500 Then
ExitLong("매도 4-1",OnClose,def,"",Floor(CurrentContracts*0.12),1);
if dd == var1+1 and stime >= 103000 and stime[1] < 103000 Then
ExitLong("매도 4-2",OnClose,def,"",Floor(CurrentContracts*0.14),1);
if dd == var1+1 and stime >= 110000 and stime[1] < 110000 Then
ExitLong("매도 4-3",OnClose,def,"",Floor(CurrentContracts*0.16),1);
if dd == var1+1 and stime >= 134000 and stime[1] < 134000 Then
ExitLong("매도 4-4",OnClose,def,"",Floor(CurrentContracts*0.20),1);
if dd == var1+1 and stime >= 143000 and stime[1] < 143000 Then
ExitLong("매도 4-5",OnClose,def,"",Floor(CurrentContracts*0.25),1);
if dd == var1+2 and stime >= 93500 and stime[1] < 93500 Then
ExitLong("매도 4-6",OnClose,def,"",Floor(CurrentContracts*0.33),1);
if dd == var1+2 and stime >= 94300 and stime[1] < 94300 Then
ExitLong("매도 4-7",OnClose,def,"",Floor(CurrentContracts*0.50),1);
if dd == var1+2 and stime >= 105000 and stime[1] < 105000 Then
ExitLong("매도 4-8");
}
}
답변 1
예스스탁 예스스탁 답변
2018-06-29 10:00:15
안녕하세요
예스스탁입니다.
식을 수정했습니다.
input : 투자금액(1000000),투자비율1(50),투자비율2(50);
var : m1(0),m2(0),dd(0);
m1 = 투자금액*(투자비율1/100);
m2 = 투자금액*(투자비율2/100);
if bdate != bdate[1] Then
{
dd = dd+1;
Condition1 = false;
}
if TotalTrades > TotalTrades[1] Then
Condition1 = true;
if MarketPosition == 0 and Condition1 == false and DayHigh < DayClose(1)*1.08 Then
{
buy("매수1",atlimit,DayClose(1)*0.985,Floor(m1/(c*0.985)));
}
if MarketPosition == 1 Then
{
if CurrentContracts > CurrentContracts[1] and MaxEntries == 1 Then
var1 = dd;
if MaxEntries == 1 and Condition1 == false Then
buy("매수2",atlimit,DayClose(1)*0.955,Floor(m2/(c*0.955)));
if EntryTime < 92000 Then
{
if dd == var1 and stime >= 93500 and stime[1] < 93500 Then
ExitLong("매도 1-1",OnClose,def,"",Floor(CurrentContracts*0.12),1);
if dd == var1 and stime >= 103000 and stime[1] < 103000 Then
ExitLong("매도 1-2",OnClose,def,"",Floor(CurrentContracts*0.14),1);
if dd == var1 and stime >= 110000 and stime[1] < 110000 Then
ExitLong("매도 1-3",OnClose,def,"",Floor(CurrentContracts*0.16),1);
if dd == var1 and stime >= 134000 and stime[1] < 134000 Then
ExitLong("매도 1-4",OnClose,def,"",Floor(CurrentContracts*0.20),1);
if dd == var1 and stime >= 143000 and stime[1] < 143000 Then
ExitLong("매도 1-5",OnClose,def,"",Floor(CurrentContracts*0.25),1);
if dd == var1+1 and stime >= 93000 and stime[1] < 93000 Then
ExitLong("매도 1-6",OnClose,def,"",Floor(CurrentContracts*0.33),1);
if dd == var1+1 and stime >= 94300 and stime[1] < 94300 Then
ExitLong("매도 1-7",OnClose,def,"",Floor(CurrentContracts*0.50),1);
if dd == var1+1 and stime >= 105000 and stime[1] < 105000 Then
ExitLong("매도 1-8");
}
if EntryTime >= 92000 and EntryTime < 110000 Then
{
if dd == var1 and stime >= 110000 and stime[1] < 110000 Then
ExitLong("매도2-1",OnClose,def,"",Floor(CurrentContracts*0.12),1);
if dd == var1 and stime >= 134000 and stime[1] < 134000 Then
ExitLong("매도2-2",OnClose,def,"",Floor(CurrentContracts*0.14),1);
if dd == var1 and stime >= 143000 and stime[1] < 143000 Then
ExitLong("매도2-3",OnClose,def,"",Floor(CurrentContracts*0.16),1);
if dd == var1+1 and stime >= 93500 and stime[1] < 93500 Then
ExitLong("매도2-4",OnClose,def,"",Floor(CurrentContracts*0.20),1);
if dd == var1+1 and stime >= 103000 and stime[1] < 103000 Then
ExitLong("매도2-5",OnClose,def,"",Floor(CurrentContracts*0.25),1);
if dd == var1+1 and stime >= 110000 and stime[1] < 110000 Then
ExitLong("매도2-6",OnClose,def,"",Floor(CurrentContracts*0.33),1);
if dd == var1+1 and stime >= 134000 and stime[1] < 134000 Then
ExitLong("매도2-7",OnClose,def,"",Floor(CurrentContracts*0.50),1);
if dd == var1+1 and stime >= 143000 and stime[1] < 143000 Then
ExitLong("매도2-8");
}
if EntryTime >= 110000 and EntryTime < 143000 Then
{
if dd == var1 and stime >= 143000 and stime[1] < 143000 Then
ExitLong("매도3-1",OnClose,def,"",Floor(CurrentContracts*0.14),1);
if dd == var1+1 and stime >= 93500 and stime[1] < 93500 Then
ExitLong("매도3-2",OnClose,def,"",Floor(CurrentContracts*0.16),1);
if dd == var1+1 and stime >= 103000 and stime[1] < 103000 Then
ExitLong("매도3-3",OnClose,def,"",Floor(CurrentContracts*0.20),1);
if dd == var1+1 and stime >= 110000 and stime[1] < 110000 Then
ExitLong("매도3-4",OnClose,def,"",Floor(CurrentContracts*0.25),1);
if dd == var1+1 and stime >= 134000 and stime[1] < 134000 Then
ExitLong("매도3-5",OnClose,def,"",Floor(CurrentContracts*0.33),1);
if dd == var1+1 and stime >= 143000 and stime[1] < 143000 Then
ExitLong("매도3-6",OnClose,def,"",Floor(CurrentContracts*0.50),1);
if dd == var1+2 and stime >= 93500 and stime[1] < 93500 Then
ExitLong("매도3-7");
}
if EntryTime >= 143000 Then
{
if dd == var1+1 and stime >= 93500 and stime[1] < 93500 Then
ExitLong("매도 4-1",OnClose,def,"",Floor(CurrentContracts*0.12),1);
if dd == var1+1 and stime >= 103000 and stime[1] < 103000 Then
ExitLong("매도 4-2",OnClose,def,"",Floor(CurrentContracts*0.14),1);
if dd == var1+1 and stime >= 110000 and stime[1] < 110000 Then
ExitLong("매도 4-3",OnClose,def,"",Floor(CurrentContracts*0.16),1);
if dd == var1+1 and stime >= 134000 and stime[1] < 134000 Then
ExitLong("매도 4-4",OnClose,def,"",Floor(CurrentContracts*0.20),1);
if dd == var1+1 and stime >= 143000 and stime[1] < 143000 Then
ExitLong("매도 4-5",OnClose,def,"",Floor(CurrentContracts*0.25),1);
if dd == var1+2 and stime >= 93500 and stime[1] < 93500 Then
ExitLong("매도 4-6",OnClose,def,"",Floor(CurrentContracts*0.33),1);
if dd == var1+2 and stime >= 94300 and stime[1] < 94300 Then
ExitLong("매도 4-7",OnClose,def,"",Floor(CurrentContracts*0.50),1);
if dd == var1+2 and stime >= 105000 and stime[1] < 105000 Then
ExitLong("매도 4-8");
}
}
즐거운 하루되세요
> 부자청년28 님이 쓴 글입니다.
> 제목 : 수식수정 부탁드립니다.
> 1)
분할매도가 마무리되어 물량이 0 이 되는날에
그당일은 다시 1차든 2차든 재매수가 안일어났으면 합니다.
2)
지금식은 1차분할매수하고 2차매수가
1차매수후 시간의 흐름에 따라 매도가 한번도 안일어났을때만되는거 같은데요
2차매수는
1차매수후 매도가 몇번이든 발생한 것과 상관없이
예를들어 1차매수후 "매도 1-2" 일어난후에
매수2차가격까지 오면 매수2차매수가 일어났으면 좋겠구요
1차매수부터의 시간의 흐름으로 진행한걸로 매도가 일어났으면 좋겠습니다.
예를들어 1차매수가 발생하고 "매도1-1" "매도1-2"가 진행되다가 주가가 떨어져서
매수2차가에 와서 매수2차가 발생되면 그후에는
매수1차와 2차가 합쳐져서 "매도 1-3"에서 매도가 일어나는 식으루요.
결국 매도는 "매도1-8" 전량 매도가 되어 물량이 0이 되게 하고 싶습니다.
3)
이게 불가능한거면
2차매수가 된시점부터 8분할 매도가 진행되어도 상관없습니다.
감사합니다.
input : 투자금액(1000000),투자비율1(50),투자비율2(50);
var : m1(0),m2(0),dd(0);
m1 = 투자금액*(투자비율1/100);
m2 = 투자금액*(투자비율2/100);
if bdate != bdate[1] Then
{
dd = dd+1;
Condition1 = false;
}
if MarketPosition == 0 and Condition1 == false and DayHigh < DayClose(1)*1.08 Then
{
buy("매수1",atlimit,DayClose(1)*0.985,Floor(m1/(c*0.985)));
}
if MarketPosition == 1 Then
{
if CurrentContracts < CurrentContracts[1] Then
Condition1 = true;
if CurrentContracts > CurrentContracts[1] and MaxEntries == 1 Then
var1 = dd;
if MaxEntries == 1 and Condition1 == false Then
buy("매수2",atlimit,DayClose(1)*0.955,Floor(m2/(c*0.955)));
if EntryTime < 92000 Then
{
if dd == var1 and stime >= 93500 and stime[1] < 93500 Then
ExitLong("매도 1-1",OnClose,def,"",Floor(CurrentContracts*0.12),1);
if dd == var1 and stime >= 103000 and stime[1] < 103000 Then
ExitLong("매도 1-2",OnClose,def,"",Floor(CurrentContracts*0.14),1);
if dd == var1 and stime >= 110000 and stime[1] < 110000 Then
ExitLong("매도 1-3",OnClose,def,"",Floor(CurrentContracts*0.16),1);
if dd == var1 and stime >= 134000 and stime[1] < 134000 Then
ExitLong("매도 1-4",OnClose,def,"",Floor(CurrentContracts*0.20),1);
if dd == var1 and stime >= 143000 and stime[1] < 143000 Then
ExitLong("매도 1-5",OnClose,def,"",Floor(CurrentContracts*0.25),1);
if dd == var1+1 and stime >= 93000 and stime[1] < 93000 Then
ExitLong("매도 1-6",OnClose,def,"",Floor(CurrentContracts*0.33),1);
if dd == var1+1 and stime >= 94300 and stime[1] < 94300 Then
ExitLong("매도 1-7",OnClose,def,"",Floor(CurrentContracts*0.50),1);
if dd == var1+1 and stime >= 105000 and stime[1] < 105000 Then
ExitLong("매도 1-8");
}
if EntryTime >= 92000 and EntryTime < 110000 Then
{
if dd == var1 and stime >= 110000 and stime[1] < 110000 Then
ExitLong("매도2-1",OnClose,def,"",Floor(CurrentContracts*0.12),1);
if dd == var1 and stime >= 134000 and stime[1] < 134000 Then
ExitLong("매도2-2",OnClose,def,"",Floor(CurrentContracts*0.14),1);
if dd == var1 and stime >= 143000 and stime[1] < 143000 Then
ExitLong("매도2-3",OnClose,def,"",Floor(CurrentContracts*0.16),1);
if dd == var1+1 and stime >= 93500 and stime[1] < 93500 Then
ExitLong("매도2-4",OnClose,def,"",Floor(CurrentContracts*0.20),1);
if dd == var1+1 and stime >= 103000 and stime[1] < 103000 Then
ExitLong("매도2-5",OnClose,def,"",Floor(CurrentContracts*0.25),1);
if dd == var1+1 and stime >= 110000 and stime[1] < 110000 Then
ExitLong("매도2-6",OnClose,def,"",Floor(CurrentContracts*0.33),1);
if dd == var1+1 and stime >= 134000 and stime[1] < 134000 Then
ExitLong("매도2-7",OnClose,def,"",Floor(CurrentContracts*0.50),1);
if dd == var1+1 and stime >= 143000 and stime[1] < 143000 Then
ExitLong("매도2-8");
}
if EntryTime >= 110000 and EntryTime < 143000 Then
{
if dd == var1 and stime >= 143000 and stime[1] < 143000 Then
ExitLong("매도3-1",OnClose,def,"",Floor(CurrentContracts*0.14),1);
if dd == var1+1 and stime >= 93500 and stime[1] < 93500 Then
ExitLong("매도3-2",OnClose,def,"",Floor(CurrentContracts*0.16),1);
if dd == var1+1 and stime >= 103000 and stime[1] < 103000 Then
ExitLong("매도3-3",OnClose,def,"",Floor(CurrentContracts*0.20),1);
if dd == var1+1 and stime >= 110000 and stime[1] < 110000 Then
ExitLong("매도3-4",OnClose,def,"",Floor(CurrentContracts*0.25),1);
if dd == var1+1 and stime >= 134000 and stime[1] < 134000 Then
ExitLong("매도3-5",OnClose,def,"",Floor(CurrentContracts*0.33),1);
if dd == var1+1 and stime >= 143000 and stime[1] < 143000 Then
ExitLong("매도3-6",OnClose,def,"",Floor(CurrentContracts*0.50),1);
if dd == var1+2 and stime >= 93500 and stime[1] < 93500 Then
ExitLong("매도3-7");
}
if EntryTime >= 143000 Then
{
if dd == var1+1 and stime >= 93500 and stime[1] < 93500 Then
ExitLong("매도 4-1",OnClose,def,"",Floor(CurrentContracts*0.12),1);
if dd == var1+1 and stime >= 103000 and stime[1] < 103000 Then
ExitLong("매도 4-2",OnClose,def,"",Floor(CurrentContracts*0.14),1);
if dd == var1+1 and stime >= 110000 and stime[1] < 110000 Then
ExitLong("매도 4-3",OnClose,def,"",Floor(CurrentContracts*0.16),1);
if dd == var1+1 and stime >= 134000 and stime[1] < 134000 Then
ExitLong("매도 4-4",OnClose,def,"",Floor(CurrentContracts*0.20),1);
if dd == var1+1 and stime >= 143000 and stime[1] < 143000 Then
ExitLong("매도 4-5",OnClose,def,"",Floor(CurrentContracts*0.25),1);
if dd == var1+2 and stime >= 93500 and stime[1] < 93500 Then
ExitLong("매도 4-6",OnClose,def,"",Floor(CurrentContracts*0.33),1);
if dd == var1+2 and stime >= 94300 and stime[1] < 94300 Then
ExitLong("매도 4-7",OnClose,def,"",Floor(CurrentContracts*0.50),1);
if dd == var1+2 and stime >= 105000 and stime[1] < 105000 Then
ExitLong("매도 4-8");
}
}