답변완료
문의 드립니다.
input : StartTime(0000),EndTime(0000);
input : 익절틱수(0),손절틱수(0);
var : Tcond(False),entry(0);
Variables: Mom(0);
IF Endtime > starttime Then
SetStopEndofday(Endtime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(Endtime);
}
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
Tcond = true;
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
{
Tcond = False;
}
if Tcond == true Then
{
if L ==lowest(L,1) and highest(H,4) >= lowest(L,2)+PriceScale*1 Then
{
Buy("b",AtStop,(highest(H,4)+lowest(L,1))/2);
}
if MarketPosition == 1 and BarsSinceEntry == 9 Then
Sell();
}
if H == highest(H,1) and lowest(L,4) <= highest(H,2)+PriceScale*1 Then
{
Sell("s",AtStop,(lowest(L,4)+highest(H,1))/2);
}
if MarketPosition == -1 and BarsSinceEntry == 9 Then
Buy();
if L ==lowest(L,1) and highest(H,4) >= lowest(L,2)+PriceScale*10 Then
{
Buy("b1",AtStop,(highest(H,4)+lowest(L,1))/2);
}
if MarketPosition == 1 and BarsSinceEntry == 9 Then
Sell();
if H == highest(H,1) and lowest(L,4) <= highest(H,2)+PriceScale*10 Then
{
Sell("s1",AtStop,(lowest(L,4)+highest(H,1))/2);
}
if MarketPosition == -1 and BarsSinceEntry == 9 Then
Buy();
if L ==lowest(L,1) and highest(H,4) >= lowest(L,2)+PriceScale*10 Then
{
Buy("b2",AtStop,(highest(H,4)+lowest(L,1))/2);
}
if MarketPosition == 1 and BarsSinceEntry == 9 Then
Sell();
if H == highest(H,1) and lowest(L,4) <= highest(H,2)+PriceScale*10 Then
{
Sell("s2",AtStop,(lowest(L,4)+highest(H,1))/2);
}
if MarketPosition == -1 and BarsSinceEntry == 9 Then
Buy();
if L ==lowest(L,1) and highest(H,4) >= lowest(L,2)+PriceScale*1 Then
{
Buy("b3",AtStop,(highest(H,4)+lowest(L,1))/2);
}
if MarketPosition == 1 and BarsSinceEntry == 9 Then
Sell();
if H == highest(H,1) and lowest(L,4) <= highest(H,2)+PriceScale*1 Then
{
Sell("s3",AtStop,(lowest(L,4)+highest(H,1))/2);
}
if MarketPosition == -1 and BarsSinceEntry == 9 Then
Buy();
if L ==lowest(L,1) and highest(H,4) >= lowest(L,2)+PriceScale*10 Then
{
Buy("b4",AtStop,(highest(H,4)+lowest(L,1))/2);
}
if MarketPosition == 1 and BarsSinceEntry == 9 Then
Sell();
if H == highest(H,1) and lowest(L,4) <= highest(H,2)+PriceScale*10 Then
{
Sell("s4",AtStop,(lowest(L,4)+highest(H,1))/2);
}
if MarketPosition == -1 and BarsSinceEntry == 9 Then
Buy();
if L ==lowest(L,1) and highest(H,4) >= lowest(L,2)+PriceScale*10 Then
{
Buy("b5",AtStop,(highest(H,4)+lowest(L,1))/2);
}
if MarketPosition == 1 and BarsSinceEntry == 9 Then
Sell();
if H == highest(H,1) and lowest(L,4) <= highest(H,2)+PriceScale*10 Then
{
Sell("s5",AtStop,(lowest(L,4)+highest(H,1))/2);
}
if MarketPosition == -1 and BarsSinceEntry == 9 Then
Buy();
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
위 수식어를 일봉에 접목을 하고 싶은데
실질적으로 전일 잔고가 있을시 미처리 부분 때문에 적용하지 못하고 있습니다.
위 수식어는 과거 데이터로 주문이 이루어지는 특성상
일봉의 매수나 매도의 신호를 장중 예약주문이 가능하지 문의 드리고
가능하다면 익절 손절은 각각 100틱으로 설정하고자 합니다.
늘 감사드립니다.
2023-12-01
1027
글번호 174495
시스템
답변완료
익절 손절 재 질문 드립니다.
답변 감사드립니다.
작성해 주신 수식을 적용해 보니 제가 생각했던 로직이랑 차이가 있는 듯 하여 추가 질문 드립니다. 제가 설명을 잘못 드린것 같습니다.
제가 생각했던것은 "A매수"로 2계약을 진행후에(단위는 모두 tic아닌 pt 입니다)
1번 진입후에 수익 +20point 도달했다. 1 계약은 청산하고 1 계약은 다음 조건 완성시까지 홀딩(-20point가 되거나 A-1 매도 조건이 되면 나머지 계약 정리. 그때까지 1 계약은 홀딩)
2번 진입후에 수익 +20point와 A-1매도 조건 도달하기 전에 -20point가 발생했다. 2 계약 모두 정리
3번 진입후에 +20point,-20point가 도달되지 않은 상황에서 A-1조건 발생. 모두 정리
진입후에 +20point에 도달하면 1 계약 정리하고 나머지 계약은 계속 홀딩하다 A-1매도
조건이 성립되면 나머지 1 계약 정리.
진입 시 +20point수익이 나면 일단 수익 챙기고 나머지 계약은 다른 조건 만족 시 까지 끝까지 가지고 가려는 생각입니다.
그리고 +20point 혹은 -20point 도달 시 조건만족 시 즉시 정리할 수 있는 방법은 없나요?
모두 봉완성 이후 시점에 정리가 되는 듯 해서요..
SetStopProfittarget와 SetStopLoss 각 매수별, 계약갯수로 지정할 수 있는 방법은 없나요?
> 예스스탁 님이 쓴 글입니다.
> 제목 : Re : 익절,손절 문의 드립니다.
>
안녕하세요
예스스탁입니다.
if MarketPosition == 1 Then
{
if IsEntryName("A매수") == true Then
{
ExitLong("Bp1",AtLimit,EntryPrice+20,"",1,1);
ExitLong("Bl1",AtLimit,EntryPrice-20,"",1,1);
if A-1 Then
ExitLong("A매수정리",atmarket,def,"A매수");
}
if IsEntryName("b매수") == true Then
{
ExitLong("Bp2",AtLimit,EntryPrice+10,"",1,1);
ExitLong("Bl2",AtLimit,EntryPrice-10,"",1,1);
if A-1 Then
ExitLong("B매수정리",atmarket,def,"A매수");
}
}
즐거운 하루되세요
> 비정성시 님이 쓴 글입니다.
> 제목 : 익절,손절 문의 드립니다.
> 항상 많은 도움 감사드립니다.
나스닥 선물 거래시 각 거래 시스템 별로 익절과 손절 값을 따로 시스템을 작성하려고 하니 방법을 잘 몰라서 도움 요청드립니다.
아래와 같이 시스템 식에 "A매수"와 "B매수"가 있을때 매수별로 조건에 따른 손절,익절,매도 식을 작성하고 싶습니다.
if MarketPosition == 0 &&
A조건
then Buy ("A매수",atmarket,def,2);
A조건으로 "A매수"로 2 계약을 진입한 뒤에
A매수 20pt 수익시 한 계약 매도(정리) - 조건 만족시 시행(봉 완성시 X)
A매수 20pt 손해시 모든 계약 매도(정리) - 조건 만족시 시행(봉 완성시 X)
if MarketPosition == 1 &&
A-1
Then
ExitLong("A매수정리",atmarket,def,"A매수");
A-1 조건 발생 시 익절,손절과 상관없이 "A매수"의 남은 계약 모두 매도
//////////////////////////////////////////////////////////////////////////
if MarketPosition == 0 &&
B조건
then Buy ("B매수",atmarket,def,2);
B조건으로 "B매수"로 2 계약을 진입한 뒤에
B매수 10pt 수익시 한 계약 매도(정리) - 조건 만족시 시행(봉 완성시 X)
B매수 10pt 손해시 모든 계약 매도(정리) - 조건 만족시 시행(봉 완성시 X)
if MarketPosition == 1 &&
B-1
Then
ExitLong("B매수정리",atmarket,def,"B매수");
B-1 조건 발생 시 익절,손절과 상관없이 "A매수"의 남은 계약 모두 매도
2023-11-30
1186
글번호 174487
시스템