커뮤니티
문의드립니다.
2014-08-14 14:31:58
164
글번호 77727
항상 도움주셔서 감사합니다.
문의가 있어 문의합니다.
문1)
일정조건 만족시 매수를 최대 3회에 걸쳐 매수한 후
일정조건 만족시 50% 매도 후 추가 일정조건 만족시 나머지 50%를
모두 매도하려고 합니다.
시스템식 부탁드립니다.
input : 투자금액1(1000000),투자금액2(1000000),투자금액3(1000000);
Input : Period(10) ;
var : Vol1(0),vol2(0),vol3(0),value(0);
if CodeCategoryEx == 11 and BasePrice < 50000 Then{
vol1 = int(int((투자금액1)/C)/10)*10;
vol2 = int(int((투자금액2)/C)/10)*10;
vol3 = int(int((투자금액3)/C)/10)*10;
}
Else{
vol1 = int((투자금액1)/C);
vol2 = int((투자금액2)/C);
vol3 = int((투자금액3)/C);
}
value = CCI(Period);
if MarketPosition == 0 and crossup(value,-100) Then
buy("b1",OnClose,def,vol1);
if MarketPosition == 1 and MaxEntries == 1 and value > -110 Then
buy("b2",atlimit,EntryPrice*0.95,vol2);
if MarketPosition == 1 and MaxEntries == 2 and value > -120 Then
buy("b3",atlimit,EntryPrice*0.90,vol3);
여기에 시스템 매도식 부탁드립니다.(최대 2차에 걸쳐 매도)
if MarketPosition == 1 and value > 100 Then
일차로 50% 매도
if value > 110 then
나머지 50% 모두 매도
문2)
어제 답변주신 부분에 대해 이해가 안되는 부분이 있어 자세한 설명 부탁드립니다.
만약에 3번에 걸쳐 매수 했을 경우
CurrentContracts < CurrentContracts[1] : 무슨 의미인지 부탁드립니다.
-> 현재 청산되지 않은 계약수가 이전 청산되지 않은 계약수보다 적은 경우
CurrentContracts > CurrentContracts[1] : 무슨 의미인지 부탁드립니다.
-> 현재 청산되지 않은 계약수가 이전 청산되지 않은 계약수보다 많은 경우
맞나요?
CurrentContracts : 포지션의 청산되지 않은 진입 계약수/포지션에서 현재의 수량을 리턴
어제 답변주신 내용
if MarketPosition == 1 Then {
var1 = countif(CurrentContracts < CurrentContracts[1],BarsSinceEntry);//청산횟수
if CurrentContracts > CurrentContracts[1] Then // ? 무슨 내용인지 이해가 안됩니다.
var2 = AvgEntryPrice;
If var1 == 0 Then // ? 무슨 내용인지 이해가 안됩니다.
ExitLong("Exit1",AtLimit,var2*1.10,"b1");
If var1 == 1 Then
{
ExitLong("Exit21",AtLimit,LatestExitPrice(0)*1.05,"b2");
ExitLong("Exit22",AtStop,LatestExitPrice(0)*0.95,"b2");
}
If var1 == 2 Then
{
ExitLong("Exit31",AtLimit,LatestExitPrice(0)*1.05,"b2");
ExitLong("Exit32",AtStop,LatestExitPrice(0)*0.95,"b2");
}
}
답변 2
예스스탁 예스스탁 답변
2014-08-14 14:58:45
안녕하세요
예스스탁입니다.
1.
input : 투자금액1(1000000),투자금액2(1000000),투자금액3(1000000);
Input : Period(10) ;
var : Vol1(0),vol2(0),vol3(0),value(0),xvol1(0);
if CodeCategoryEx == 11 and BasePrice < 50000 Then{
vol1 = int(int((투자금액1)/C)/10)*10;
vol2 = int(int((투자금액2)/C)/10)*10;
vol3 = int(int((투자금액3)/C)/10)*10;
}
Else{
vol1 = int((투자금액1)/C);
vol2 = int((투자금액2)/C);
vol3 = int((투자금액3)/C);
}
value = CCI(Period);
if MarketPosition == 0 and crossup(value,-100) Then
buy("b1",OnClose,def,vol1);
if MarketPosition == 1 and MaxEntries == 1 and value > -110 Then
buy("b2",atlimit,EntryPrice*0.95,vol2);
if MarketPosition == 1 and MaxEntries == 2 and value > -120 Then
buy("b3",atlimit,EntryPrice*0.90,vol3);
if MarketPosition == 1 Then{
if CodeCategoryEx == 11 and BasePrice < 50000 Then
xvol1 = int(int(MaxContracts*0.5)/10)*10;
Else
xvol1 = int(MaxContracts*0.5);
if CurrentContracts == MaxContracts and value > 100 Then
exitlong("bx1",OnClose,def,"",Xvol1,1);
if CurrentContracts < MaxContracts and value > 110 Then
exitlong("bx2");
}
2.
CurrentContracts 는 현재 보유수량입니다.
CurrentContracts < CurrentContracts[1]
-> 현재 청산되지 않은 계약수가 이전 청산되지 않은 계약수보다 적은 경우
-> 위 내용은 청산이 발생해서 보유수량이 줄었음을 나타내는 표현입니다.
CurrentContracts > CurrentContracts[1]
-> 현재 청산되지 않은 계약수가 이전 청산되지 않은 계약수보다 많은 경우
-> 위 내용은 첫진입이나 추가진입이 발생해서 보유수량이 증가했음을 나타내는 표현입니다.
주로 포지션 진입중에 추가진입이나 일부청산등을 감지할떄 사용됩니다.
3.
if MarketPosition == 1 Then {
var1 = countif(CurrentContracts < CurrentContracts[1],BarsSinceEntry);//청산횟수
if CurrentContracts > CurrentContracts[1] Then
var2 = AvgEntryPrice;
If var1 == 0 Then // ? 무슨 내용인지 이해가 안됩니다.
ExitLong("Exit1",AtLimit,var2*1.10,"b1");
If var1 == 1 Then
{
ExitLong("Exit21",AtLimit,LatestExitPrice(0)*1.05,"b2");
ExitLong("Exit22",AtStop,LatestExitPrice(0)*0.95,"b2");
}
If var1 == 2 Then
{
ExitLong("Exit31",AtLimit,LatestExitPrice(0)*1.05,"b2");
ExitLong("Exit32",AtStop,LatestExitPrice(0)*0.95,"b2");
}
}
위 식에서 var1은 진입이후에 일부청산을 한 횟수를 나타냅니다.
var1 == 0 은 진입이후에 일부청산이 한번도 발생하지 않았음을(1차청산이 없었음)
var1 == 1 은 진입이후에 일부청산이 1회 발생했음을 (1차청산이 발생한 이후)
var1 == 2 는 진입이후에 일부청산이 2회 발생했음을 (2차청산까지 발생한 이후)
나타냅니다. 분할청산을 할때 주로 사용하는 표현입니다.
즐거운 하루되세요
> 양치기 님이 쓴 글입니다.
> 제목 : 문의드립니다.
> 항상 도움주셔서 감사합니다.
문의가 있어 문의합니다.
문1)
일정조건 만족시 매수를 최대 3회에 걸쳐 매수한 후
일정조건 만족시 50% 매도 후 추가 일정조건 만족시 나머지 50%를
모두 매도하려고 합니다.
시스템식 부탁드립니다.
input : 투자금액1(1000000),투자금액2(1000000),투자금액3(1000000);
Input : Period(10) ;
var : Vol1(0),vol2(0),vol3(0),value(0);
if CodeCategoryEx == 11 and BasePrice < 50000 Then{
vol1 = int(int((투자금액1)/C)/10)*10;
vol2 = int(int((투자금액2)/C)/10)*10;
vol3 = int(int((투자금액3)/C)/10)*10;
}
Else{
vol1 = int((투자금액1)/C);
vol2 = int((투자금액2)/C);
vol3 = int((투자금액3)/C);
}
value = CCI(Period);
if MarketPosition == 0 and crossup(value,-100) Then
buy("b1",OnClose,def,vol1);
if MarketPosition == 1 and MaxEntries == 1 and value > -110 Then
buy("b2",atlimit,EntryPrice*0.95,vol2);
if MarketPosition == 1 and MaxEntries == 2 and value > -120 Then
buy("b3",atlimit,EntryPrice*0.90,vol3);
여기에 시스템 매도식 부탁드립니다.(최대 2차에 걸쳐 매도)
if MarketPosition == 1 and value > 100 Then
일차로 50% 매도
if value > 110 then
나머지 50% 모두 매도
문2)
어제 답변주신 부분에 대해 이해가 안되는 부분이 있어 자세한 설명 부탁드립니다.
만약에 3번에 걸쳐 매수 했을 경우
CurrentContracts < CurrentContracts[1] : 무슨 의미인지 부탁드립니다.
-> 현재 청산되지 않은 계약수가 이전 청산되지 않은 계약수보다 적은 경우
CurrentContracts > CurrentContracts[1] : 무슨 의미인지 부탁드립니다.
-> 현재 청산되지 않은 계약수가 이전 청산되지 않은 계약수보다 많은 경우
맞나요?
CurrentContracts : 포지션의 청산되지 않은 진입 계약수/포지션에서 현재의 수량을 리턴
어제 답변주신 내용
if MarketPosition == 1 Then {
var1 = countif(CurrentContracts < CurrentContracts[1],BarsSinceEntry);//청산횟수
if CurrentContracts > CurrentContracts[1] Then // ? 무슨 내용인지 이해가 안됩니다.
var2 = AvgEntryPrice;
If var1 == 0 Then // ? 무슨 내용인지 이해가 안됩니다.
ExitLong("Exit1",AtLimit,var2*1.10,"b1");
If var1 == 1 Then
{
ExitLong("Exit21",AtLimit,LatestExitPrice(0)*1.05,"b2");
ExitLong("Exit22",AtStop,LatestExitPrice(0)*0.95,"b2");
}
If var1 == 2 Then
{
ExitLong("Exit31",AtLimit,LatestExitPrice(0)*1.05,"b2");
ExitLong("Exit32",AtStop,LatestExitPrice(0)*0.95,"b2");
}
}
양치기
2014-08-14 15:56:11
양치기 님에 의해 삭제된 답변입니다.