커뮤니티
수식 부탁드립니다.
2015-05-31 13:09:54
163
글번호 86593
안녕하십니까? 매번 성의있는 답변 감사드립니다.
예전에 올렸던 질문인데 약간 제가 애매하게 질문을 했던듯 해서 다시 올립니다.
1.
격일제로 거래하는 것이 아니라,
한 주는 월수금, 그 다음주는 화목, 그 다음주는 월수금, 그 다음주는 화목....
이런식으로 월수금화목 월수금화목...
으로 거래하는 식 부탁드립니다.
아래식은 예전에 답변 주셨던 식인데,
"if entry == true then{"
true 로 되어있을 때는 화목만 진입하고 false 로 바꾸니까 월수금만 진입하더군요.
var : Week(0),entry(false),Start(false);
if stime == 160000 or (stime > 160000 and stime[1] < 160000) Then{
entry = false;
var1 = O;
Week = DayOfWeek(sdate);
if Week%2 == 0 Then
Entry = true;
}
if entry == true then{
if MarketPosition <= 0 and stime == 155000 Then
buy("b1",AtStop,round(NextBarOpen*1.01,3));
if MarketPosition >= 0 and stime == 155000 Then
sell("s1",AtStop,round(NextBarOpen*0.99,3));
if MarketPosition <= 0 and H < var1*1.01 Then
buy("b",AtStop,round(var1*1.01,3));
if MarketPosition >= 0 and L > var1*0.99 Then
sell("s",AtStop,round(var1*0.99,3));
}
if MarketPosition == 1 Then
ExitLong("bx",AtStop,round(EntryPrice*0.99,3));
if MarketPosition == -1 Then
ExitLong("sx",AtStop,round(EntryPrice*1.01,3));
2.
아래식에서 손절이 발생했을 때와 bx1, sx1 이 발생했을 경우에도
10분간 재진입 금지에 관한 식을 부탁드립니다.
--------------------------------------------------------
그리고
아래 두 표현이 무슨 뜻인지 궁금합니다.
그리고 bdate 는 매뉴얼에 안나오는데 함수인데 무슨 뜻인지요?
date != date[1]
bdate != Bdate[1]
--------------------------------------------------------
Input : N(1);
Var : HH(0), LL(0), Loss(0);
if stime == 160000 or (stime > 160000 and stime[1] < 160000) Then
var1 = O;
if MarketPosition == 0 and CurrentContracts < CurrentContracts[1] and
(IsExitName("Bx",1) == true or IsExitName("Sx",1) == true) Then
loss = loss+1;
if MarketPosition <= 0 and stime == 155000 Then
buy("b1",AtStop,NextBarOpen*1.01);
if MarketPosition >= 0 and stime == 155000 Then
sell("s1",AtStop,NextBarOpen*0.99);
if loss < N then{
if MarketPosition <= 0 and H < var1*1.01 Then
buy("b",AtStop,var1*1.01);
if MarketPosition >= 0 and L > var1*0.99 Then
sell("s",AtStop,var1*0.99);
}
if MarketPosition == 1 Then{
HH = highest(H,BarsSinceEntry);
if HH >= EntryPrice*1.1 and HH < EntryPrice*1.2 Then
ExitLong("bx1",AtStop,HH-(HH-EntryPrice)*0.5);
if HH >= EntryPrice*1.2 and HH < EntryPrice*1.3 Then
ExitLong("bx2",AtStop,HH-(HH-EntryPrice)*0.6);
if HH >= EntryPrice*1.3 Then
ExitLong("bx3",AtStop,HH-(HH-EntryPrice)*0.7);
}
if MarketPosition == -1 Then{
LL = lowest(L,BarsSinceEntry);
if LL <= EntryPrice*0.9 and LL > EntryPrice*0.8 Then
ExitShort("sx1",AtStop,LL+(EntryPrice-LL)*0.5);
if LL <= EntryPrice*0.8 and LL > EntryPrice*0.7 Then
ExitShort("sx2",AtStop,LL+(EntryPrice-LL)*0.6);
if LL <= EntryPrice*0.7 Then
ExitShort("sx3",AtStop,LL+(EntryPrice-LL)*0.7);
}
if MarketPosition == 1 Then
ExitLong("Bx",AtStop,Round(EntryPrice*0.99,2));
if MarketPosition == -1 Then
ExitShort("Sx",AtStop,Round(EntryPrice*1.01,2));
3.
위 2번 질문의 식을 보면 손절이 발생하면,
발생한 날은 진입하지 않게 되어 있는데,
2번의 식에서 bx1 과 sx1 이 발생했을 때도 더 이상 진입 안하는 식이 궁금합니다.
다만, 2번 식의 경우 손절(bx, sx)이 1회 발생하면
그 손절이 당일 진입해서 당일 손절하였든,
며칠 전에 진입해서 손절 당일 손절하였든,
어쨌든 손절이 발생한 그날은 진입 안하게 되어있는데,
bx1 과 sx1 의 경우는 당일 진입해서 당일 발생한 경우만 더 진입 안했으면 합니다.
즉, 며칠전에 진입해서 당일 bx1 또는 sx1 이 발생하면,
당일은 당일 시가를 기준으로 진입 할 수 있습니다.
4.
이건 수식과 관련없는 질문입니다만,
예스트레이더에서 데이터가 덜 들어오는 경우가 있더군요.
10분 봉일 때는 데이터가 다 잡히는데,
1분 봉으로 바꾸면 덜들어온다던지 하는 경우 말입니다.
1분 봉으로 할 때 더 정확한 데 꼭 고쳤으면 합니다.
예를들어,
10분봉이나 5분봉에는 최저가로 100 이 나오는데,
1분 봉으로 하면 안나온다던가 하는 경우 말입니다.
해외선물 FTSE China A50 을 보시면
5분이나 10분봉으로 보면 5.18, 16:20 에 나오는 데이터가
1분 봉에서는 안나옵니다.
이건 연결선물이나 그냥 일반선물이나 둘 다 그렇습니다.
다른 HTS 도 보니 그 데이터가 1분 봉에서 빠진게 맞는 것 같습니다.
그리고 다른 종목에서도 이런 경우가 있는 듯 합니다.
그리고 틱차트는 최근 몇일만 수신이 되고 더 과거는 수신이 안되네요.
이건 예스트레이더 문제인가요? 아니면 제가 쓰는 증권사에 문의해야 되는건가요?
답변 1
예스스탁 예스스탁 답변
2015-06-01 10:50:40
안녕하세요
예스스탁입니다.
1
문의하신 내용은 월수금-화목-월수금-화목으로 반복되므로
2일에 한번씩 거래하는 내용입니다.
격일로 거래되는 식으로 올려드립니다.
var : Dcount(0),entry(false),Start(false);
if stime == 160000 or (stime > 160000 and stime[1] < 160000) Then{
entry = false;
var1 = O;
Dcount = Dcount+1;
if Dcount%2 == 0 Then
Entry = true;
}
if entry == true then{
if MarketPosition <= 0 and stime == 155000 Then
buy("b1",AtStop,round(NextBarOpen*1.01,3));
if MarketPosition >= 0 and stime == 155000 Then
sell("s1",AtStop,round(NextBarOpen*0.99,3));
if MarketPosition <= 0 and H < var1*1.01 Then
buy("b",AtStop,round(var1*1.01,3));
if MarketPosition >= 0 and L > var1*0.99 Then
sell("s",AtStop,round(var1*0.99,3));
}
if MarketPosition == 1 Then
ExitLong("bx",AtStop,round(EntryPrice*0.99,3));
if MarketPosition == -1 Then
ExitLong("sx",AtStop,round(EntryPrice*1.01,3));
2.
date != date[1]
봉의 캘린더날짜를 기준으로 한봉전과 현재봉을 비교해 날짜가 변경된 봉을 찾는 식입니다.
그러므로 0시 이후의 첫봉입니다.
bdate != Bdate[1]
영업일(business date)을 기준으로 일자가 변경된 봉을 찾는 식입니다.
영업일 변경후 첫봉입니다.
24시간 거래되는 종목의 경우 새로운 영업일 시작하는 봉의 시간이 0시가 아닙니다.
종목별로 다르므로 해당 시간을 표현하기 위한 식입니다.
3.
Input : N(1);
Var : HH(0), LL(0), Loss(0),BD(0);
if stime == 160000 or (stime > 160000 and stime[1] < 160000) Then{
var1 = O;
BD = Bdate;
}
if MarketPosition == 0 and CurrentContracts < CurrentContracts[1] and
(IsExitName("Bx",1) == true or IsExitName("Sx",1) == true) Then
loss = loss+1;
if MarketPosition == 0 and CurrentContracts < CurrentContracts[1] and
Bdate[BarsSinceEntry(1)] == Bdate and
(IsExitName("bx1",1) == true or IsExitName("bx1",1) == true) Then
loss = loss+1;
if MarketPosition <= 0 and stime == 155000 Then
buy("b1",AtStop,NextBarOpen*1.01);
if MarketPosition >= 0 and stime == 155000 Then
sell("s1",AtStop,NextBarOpen*0.99);
if loss < N then{
if MarketPosition <= 0 and H < var1*1.01 Then
buy("b",AtStop,var1*1.01);
if MarketPosition >= 0 and L > var1*0.99 Then
sell("s",AtStop,var1*0.99);
}
if MarketPosition == 1 Then{
HH = highest(H,BarsSinceEntry);
if HH >= EntryPrice*1.1 and HH < EntryPrice*1.2 Then
ExitLong("bx1",AtStop,HH-(HH-EntryPrice)*0.5);
if HH >= EntryPrice*1.2 and HH < EntryPrice*1.3 Then
ExitLong("bx2",AtStop,HH-(HH-EntryPrice)*0.6);
if HH >= EntryPrice*1.3 Then
ExitLong("bx3",AtStop,HH-(HH-EntryPrice)*0.7);
}
if MarketPosition == -1 Then{
LL = lowest(L,BarsSinceEntry);
if LL <= EntryPrice*0.9 and LL > EntryPrice*0.8 Then
ExitShort("sx1",AtStop,LL+(EntryPrice-LL)*0.5);
if LL <= EntryPrice*0.8 and LL > EntryPrice*0.7 Then
ExitShort("sx2",AtStop,LL+(EntryPrice-LL)*0.6);
if LL <= EntryPrice*0.7 Then
ExitShort("sx3",AtStop,LL+(EntryPrice-LL)*0.7);
}
if MarketPosition == 1 Then
ExitLong("Bx",AtStop,Round(EntryPrice*0.99,2));
if MarketPosition == -1 Then
ExitShort("Sx",AtStop,Round(EntryPrice*1.01,2));
4.
제공되는 데이터는 저희쪽에서 관리하는 부분이 아니라서 저희쪽에서는
정확한 답변이 어렵습니다. 사용하시는 선물사에 문의를 하셔야 할것 같습니다.
즐거운 하루되세요
> spek 님이 쓴 글입니다.
> 제목 : 수식 부탁드립니다.
> 안녕하십니까? 매번 성의있는 답변 감사드립니다.
예전에 올렸던 질문인데 약간 제가 애매하게 질문을 했던듯 해서 다시 올립니다.
1.
격일제로 거래하는 것이 아니라,
한 주는 월수금, 그 다음주는 화목, 그 다음주는 월수금, 그 다음주는 화목....
이런식으로 월수금화목 월수금화목...
으로 거래하는 식 부탁드립니다.
아래식은 예전에 답변 주셨던 식인데,
"if entry == true then{"
true 로 되어있을 때는 화목만 진입하고 false 로 바꾸니까 월수금만 진입하더군요.
var : Week(0),entry(false),Start(false);
if stime == 160000 or (stime > 160000 and stime[1] < 160000) Then{
entry = false;
var1 = O;
Week = DayOfWeek(sdate);
if Week%2 == 0 Then
Entry = true;
}
if entry == true then{
if MarketPosition <= 0 and stime == 155000 Then
buy("b1",AtStop,round(NextBarOpen*1.01,3));
if MarketPosition >= 0 and stime == 155000 Then
sell("s1",AtStop,round(NextBarOpen*0.99,3));
if MarketPosition <= 0 and H < var1*1.01 Then
buy("b",AtStop,round(var1*1.01,3));
if MarketPosition >= 0 and L > var1*0.99 Then
sell("s",AtStop,round(var1*0.99,3));
}
if MarketPosition == 1 Then
ExitLong("bx",AtStop,round(EntryPrice*0.99,3));
if MarketPosition == -1 Then
ExitLong("sx",AtStop,round(EntryPrice*1.01,3));
2.
아래식에서 손절이 발생했을 때와 bx1, sx1 이 발생했을 경우에도
10분간 재진입 금지에 관한 식을 부탁드립니다.
--------------------------------------------------------
그리고
아래 두 표현이 무슨 뜻인지 궁금합니다.
그리고 bdate 는 매뉴얼에 안나오는데 함수인데 무슨 뜻인지요?
date != date[1]
bdate != Bdate[1]
--------------------------------------------------------
Input : N(1);
Var : HH(0), LL(0), Loss(0);
if stime == 160000 or (stime > 160000 and stime[1] < 160000) Then
var1 = O;
if MarketPosition == 0 and CurrentContracts < CurrentContracts[1] and
(IsExitName("Bx",1) == true or IsExitName("Sx",1) == true) Then
loss = loss+1;
if MarketPosition <= 0 and stime == 155000 Then
buy("b1",AtStop,NextBarOpen*1.01);
if MarketPosition >= 0 and stime == 155000 Then
sell("s1",AtStop,NextBarOpen*0.99);
if loss < N then{
if MarketPosition <= 0 and H < var1*1.01 Then
buy("b",AtStop,var1*1.01);
if MarketPosition >= 0 and L > var1*0.99 Then
sell("s",AtStop,var1*0.99);
}
if MarketPosition == 1 Then{
HH = highest(H,BarsSinceEntry);
if HH >= EntryPrice*1.1 and HH < EntryPrice*1.2 Then
ExitLong("bx1",AtStop,HH-(HH-EntryPrice)*0.5);
if HH >= EntryPrice*1.2 and HH < EntryPrice*1.3 Then
ExitLong("bx2",AtStop,HH-(HH-EntryPrice)*0.6);
if HH >= EntryPrice*1.3 Then
ExitLong("bx3",AtStop,HH-(HH-EntryPrice)*0.7);
}
if MarketPosition == -1 Then{
LL = lowest(L,BarsSinceEntry);
if LL <= EntryPrice*0.9 and LL > EntryPrice*0.8 Then
ExitShort("sx1",AtStop,LL+(EntryPrice-LL)*0.5);
if LL <= EntryPrice*0.8 and LL > EntryPrice*0.7 Then
ExitShort("sx2",AtStop,LL+(EntryPrice-LL)*0.6);
if LL <= EntryPrice*0.7 Then
ExitShort("sx3",AtStop,LL+(EntryPrice-LL)*0.7);
}
if MarketPosition == 1 Then
ExitLong("Bx",AtStop,Round(EntryPrice*0.99,2));
if MarketPosition == -1 Then
ExitShort("Sx",AtStop,Round(EntryPrice*1.01,2));
3.
위 2번 질문의 식을 보면 손절이 발생하면,
발생한 날은 진입하지 않게 되어 있는데,
2번의 식에서 bx1 과 sx1 이 발생했을 때도 더 이상 진입 안하는 식이 궁금합니다.
다만, 2번 식의 경우 손절(bx, sx)이 1회 발생하면
그 손절이 당일 진입해서 당일 손절하였든,
며칠 전에 진입해서 손절 당일 손절하였든,
어쨌든 손절이 발생한 그날은 진입 안하게 되어있는데,
bx1 과 sx1 의 경우는 당일 진입해서 당일 발생한 경우만 더 진입 안했으면 합니다.
즉, 며칠전에 진입해서 당일 bx1 또는 sx1 이 발생하면,
당일은 당일 시가를 기준으로 진입 할 수 있습니다.
4.
이건 수식과 관련없는 질문입니다만,
예스트레이더에서 데이터가 덜 들어오는 경우가 있더군요.
10분 봉일 때는 데이터가 다 잡히는데,
1분 봉으로 바꾸면 덜들어온다던지 하는 경우 말입니다.
1분 봉으로 할 때 더 정확한 데 꼭 고쳤으면 합니다.
예를들어,
10분봉이나 5분봉에는 최저가로 100 이 나오는데,
1분 봉으로 하면 안나온다던가 하는 경우 말입니다.
해외선물 FTSE China A50 을 보시면
5분이나 10분봉으로 보면 5.18, 16:20 에 나오는 데이터가
1분 봉에서는 안나옵니다.
이건 연결선물이나 그냥 일반선물이나 둘 다 그렇습니다.
다른 HTS 도 보니 그 데이터가 1분 봉에서 빠진게 맞는 것 같습니다.
그리고 다른 종목에서도 이런 경우가 있는 듯 합니다.
그리고 틱차트는 최근 몇일만 수신이 되고 더 과거는 수신이 안되네요.
이건 예스트레이더 문제인가요? 아니면 제가 쓰는 증권사에 문의해야 되는건가요?
이전글