커뮤니티
문의드립니다.
2011-03-10 17:47:03
654
글번호 36455
아래 식에서
=========================================================
input : Profit1(50),Profit2(100),Loss1(50),Loss2(100);
var : D1H(0,data1),D1L(0,data1),D2H(0,data2),D2L(0,data2);
if data1(dayindex) == 0 Then{
D1H = data1(H);
D1L = data1(L);
}
if data2(dayindex) == 0 Then{
D2H = data2(H);
D2L = data2(L);
}
if MarketPosition == 0 and ExitDate(1) != sdate and sTime < 140000 Then{
if data1(dayindex > 0 and crossup(h,D1H)) and data2(dayindex > 0 and crossup(h,D2H)) Then
buy();
if data1(dayindex > 0 and CrossDown(l,D1L)) and data2(dayindex > 0 and CrossDown(l,D2L)) Then
Sell();
}
if MarketPosition == 1 Then{
if MarketPosition[1] != 1 Then {
var1 = CurrentContracts;
var2 = int(CurrentContracts/2);
}
ExitLong("bP1",atlimit,EntryPrice*(1+Profit1/100),"",var2,1);
ExitLong("bP2",atlimit,EntryPrice*(1+Profit2/100));
ExitLong("bL1",AtStop,EntryPrice*(1-Loss1/100),"",var2,1);
ExitLong("bL2",AtStop,EntryPrice*(1-Loss2/100));
}
if MarketPosition == -1 Then{
if MarketPosition[1] != -1 Then {
var1 = CurrentContracts;
var2 = int(CurrentContracts/2);
}
ExitShort("sP1",atlimit,EntryPrice*(1-Profit1/100),"",var2,1);
ExitShort("sP2",atlimit,EntryPrice*(1-Profit2/100));
ExitShort("sL1",AtStop,EntryPrice*(1+Loss1/100),"",var2,1);
ExitShort("sL2",AtStop,EntryPrice*(1+Loss2/100));
}
SetStopEndofday(150000);
=====================================================================
data1은 콜옵션 data2는 연결선물입니다.
100주를 매매중이라고 가정하고.....
data1에서 매수나 매도 신호가 발생한 봉의 종가대비해서
50% 상승하면 50주 청산하고 100% 상승하면 나머지 물량인 50주도 청산되어야하는데...
청산이 한번 나옵니다....수식의 어디가 잘못되었는지요???
50% 상승이나 하락이 안나오면 전량 3시에 청산인데...한번도 3시 청산이 안나오니....
뭐가 잘못된건지....부탁드립니다.
답변 1
예스스탁 예스스탁 답변
2011-03-10 18:22:36
안녕하세요
예스스탁입니다.
당일청산이 나오지 않는 것은 직전에 어떤 청산이든 발생해서
포지션을 청산하기 때문입니다.
또한 시스템 함수에서 atstop이나 atlmit을 사용시에
값이 0이들어가지 않도록 하셔야 합니다. 0을 입력하시면
if조건만족봉 다음봉 시가에 바로 신호가 발생하게 됩니다.
식상ㅇ에서는 매수에서 손절과 매도에서 수익청산내용을 조절하셔야 합니다.
매수포지션에서 100% 손실시 청산은 해당 종목의 값이 0이라는 의미입니다.
또한 매도포지션에서 100%수익은 마찬가지로 해당종목의 값이 0이라는 의미로
실제 거래와도 맞지 않습니다.
수식을 매수와 매도에 따른 수익손실을 구분해서
설정하실수 있게 수식을 변경했습니다.
매수에서 손절(BLoss2)과 매도에서 수익(SProfit2)의 %값을 조절하시기 바랍니다.
100% 미만으로 설정하시면 신호확인하실 수 있습니다.
input : BProfit1(50),BProfit2(100),BLoss1(50),BLoss2(100);#매수포지션 청산 설정
input : SProfit1(50),SProfit2(100),SLoss1(50),SLoss2(100);#매도포지션 청산 설정
var : D1H(0,data1),D1L(0,data1),D2H(0,data2),D2L(0,data2);
if data1(dayindex) == 0 Then{
D1H = data1(H);
D1L = data1(L);
}
if data2(dayindex) == 0 Then{
D2H = data2(H);
D2L = data2(L);
}
if MarketPosition == 0 and ExitDate(1) != sdate and sTime < 140000 Then{
if data1(dayindex > 0 and crossup(h,D1H)) and data2(dayindex > 0 and crossup(h,D2H)) Then
buy();
if data1(dayindex > 0 and CrossDown(l,D1L)) and data2(dayindex > 0 and CrossDown(l,D2L)) Then
Sell();
}
if MarketPosition == 1 Then{
if MarketPosition[1] != 1 Then {
var1 = CurrentContracts;
var2 = int(CurrentContracts/2);
}
ExitLong("bP1",atlimit,EntryPrice*(1+BProfit1/100),"",var2,1);
ExitLong("bP2",atlimit,EntryPrice*(1+BProfit2/100));
ExitLong("bL1",AtStop,EntryPrice*(1-BLoss1/100),"",var2,1);
ExitLong("bL2",AtStop,EntryPrice*(1-BLoss2/100));
}
if MarketPosition == -1 Then{
if MarketPosition[1] != -1 Then {
var1 = CurrentContracts;
var2 = int(CurrentContracts/2);
}
ExitShort("sP1",atlimit,EntryPrice*(1-SProfit1/100),"",var2,1);
ExitShort("sP2",atlimit,EntryPrice*(1-SProfit2/100));
ExitShort("sL1",AtStop,EntryPrice*(1+SLoss1/100),"",var2,1);
ExitShort("sL2",AtStop,EntryPrice*(1+SLoss2/100));
}
SetStopEndofday(150000);
즐거운 하루되세요
> 산천초목 님이 쓴 글입니다.
> 제목 : 문의드립니다.
> 아래 식에서
=========================================================
input : Profit1(50),Profit2(100),Loss1(50),Loss2(100);
var : D1H(0,data1),D1L(0,data1),D2H(0,data2),D2L(0,data2);
if data1(dayindex) == 0 Then{
D1H = data1(H);
D1L = data1(L);
}
if data2(dayindex) == 0 Then{
D2H = data2(H);
D2L = data2(L);
}
if MarketPosition == 0 and ExitDate(1) != sdate and sTime < 140000 Then{
if data1(dayindex > 0 and crossup(h,D1H)) and data2(dayindex > 0 and crossup(h,D2H)) Then
buy();
if data1(dayindex > 0 and CrossDown(l,D1L)) and data2(dayindex > 0 and CrossDown(l,D2L)) Then
Sell();
}
if MarketPosition == 1 Then{
if MarketPosition[1] != 1 Then {
var1 = CurrentContracts;
var2 = int(CurrentContracts/2);
}
ExitLong("bP1",atlimit,EntryPrice*(1+Profit1/100),"",var2,1);
ExitLong("bP2",atlimit,EntryPrice*(1+Profit2/100));
ExitLong("bL1",AtStop,EntryPrice*(1-Loss1/100),"",var2,1);
ExitLong("bL2",AtStop,EntryPrice*(1-Loss2/100));
}
if MarketPosition == -1 Then{
if MarketPosition[1] != -1 Then {
var1 = CurrentContracts;
var2 = int(CurrentContracts/2);
}
ExitShort("sP1",atlimit,EntryPrice*(1-Profit1/100),"",var2,1);
ExitShort("sP2",atlimit,EntryPrice*(1-Profit2/100));
ExitShort("sL1",AtStop,EntryPrice*(1+Loss1/100),"",var2,1);
ExitShort("sL2",AtStop,EntryPrice*(1+Loss2/100));
}
SetStopEndofday(150000);
=====================================================================
data1은 콜옵션 data2는 연결선물입니다.
100주를 매매중이라고 가정하고.....
data1에서 매수나 매도 신호가 발생한 봉의 종가대비해서
50% 상승하면 50주 청산하고 100% 상승하면 나머지 물량인 50주도 청산되어야하는데...
청산이 한번 나옵니다....수식의 어디가 잘못되었는지요???
50% 상승이나 하락이 안나오면 전량 3시에 청산인데...한번도 3시 청산이 안나오니....
뭐가 잘못된건지....부탁드립니다.
다음글
이전글