커뮤니티
부탁드립니다.
2016-08-30 01:03:43
107
글번호 101463
코스피 선물, S&P선물에서 사용하려고 합니다
-15분봉 기준
-장 시작하고 두번째 봉의 고가 또는 저가를 breakout할때 진입
(국내로 치면 9시15분~9시30분의 봉, S&P의경우 22시45분~23시의 캔들이 기준)
-청산은 트레일링스탑
-장종료전에 포지션 청산
Var : orderCnt(1);
Var : Start(false);
If (stime == 071500 or (stime > 071500 and stime[1] < 071500)) then
Start = false;
If sdate == CurrentDate and (stime == 080000 or (stime > 080000 and stime[1] < 080000)) Then
Start = True;
If Start == true Then{
If C > O Then
buy("LE",AtStop,TimeHigh(084501,090000) + PriceScale,ordercnt);
If C < O Then
sell("SE",AtStop,TimeLow(084501,090000) - PriceScale,ordercnt);
#매수/매도 진입
#Buy("BUY",AtStop,TimeHigh(084501,090000) + PriceScale,ordercnt);
#Sell("SELL",AtStop,TimeLow(084501,090000) - PriceScale,ordercnt);
#스탑설정
If MarketPosition == 1 Then
ExitLong("스탑B",AtStop,TimeLow(084501,090000));
If MarketPosition == -1 Then
ExitShort("스탑S",AtStop,TimeHigh(084501,090000));
#트레일링 청산
If (MarketPosition == 1 or MarketPosition == -1) and CurrentContracts == MaxContracts Then
SetStopTrailing(1.5,4,PointStop,0);
#장마감전 청산
#SetStopEndofday(1515);
답변 1
예스스탁 예스스탁 답변
2016-08-30 16:48:33
안녕하세요
예스스탁입니다.
당일 두번째 봉의 고저가를 이용하게 수정했습니다.
다만 올리신 내용에 S&P500선물의 두번째 봉의 시간이 조금이상합니다.
Var : idx(0);
If Bdate != Bdate[1] then{
idx = 0;
}
idx = idx+1;
plot1(idx);
위식을 지표식으로 작성해 차트에 적용하시면
영업일 변경을 기준으로 당일 봉수를 보실수 있습니다.
아래는 영업일 변경기준으로 봉수를 체크해 2번째봉의 고저값을
이용하게 작성한 식입니다.
Var : orderCnt(1),Start(false),idx(0),HH(0),LL(0);
If Bdate != Bdate[1] then{
Start = false;
idx = 0;
}
idx = idx+1;
if idx == 2 Then{
HH = H;
LL = L;
}
If sdate == CurrentDate and idx >= 2 Then
Start = True;
If Start == true Then{
If C > O Then
buy("LE",AtStop,HH + PriceScale,ordercnt);
If C < O Then
sell("SE",AtStop,LL - PriceScale,ordercnt);
#스탑설정
If MarketPosition == 1 Then
ExitLong("스탑B",AtStop,LL);
If MarketPosition == -1 Then
ExitShort("스탑S",AtStop,HH);
#트레일링 청산
If (MarketPosition == 1 or MarketPosition == -1) and CurrentContracts == MaxContracts Then
SetStopTrailing(1.5,4,PointStop,0);
}
원하신는 다른시간이 있으시면
아래 시작시간을 지정하는 식을 이용하셔도 됩니다.
해당 시간이후 봉수를 카운트해 두번째 봉에서 신호가 발생합니다.
input : 시작(90000);
Var : orderCnt(1),Start(false),idx(0),HH(0),LL(0);
If stime == 시작 or (stime > 시작 and stime[1] < 시작) then{
Start = false;
idx = 0;
}
idx = idx+1;
if idx == 2 Then{
HH = H;
LL = L;
}
If sdate == CurrentDate and idx >= 2 Then
Start = True;
If Start == true Then{
If C > O Then
buy("LE",AtStop,HH + PriceScale,ordercnt);
If C < O Then
sell("SE",AtStop,LL - PriceScale,ordercnt);
#스탑설정
If MarketPosition == 1 Then
ExitLong("스탑B",AtStop,LL);
If MarketPosition == -1 Then
ExitShort("스탑S",AtStop,HH);
#트레일링 청산
If (MarketPosition == 1 or MarketPosition == -1) and CurrentContracts == MaxContracts Then
SetStopTrailing(1.5,4,PointStop,0);
}
즐거운 하루되세요
> 폴폴 님이 쓴 글입니다.
> 제목 : 부탁드립니다.
> 코스피 선물, S&P선물에서 사용하려고 합니다
-15분봉 기준
-장 시작하고 두번째 봉의 고가 또는 저가를 breakout할때 진입
(국내로 치면 9시15분~9시30분의 봉, S&P의경우 22시45분~23시의 캔들이 기준)
-청산은 트레일링스탑
-장종료전에 포지션 청산
Var : orderCnt(1);
Var : Start(false);
If (stime == 071500 or (stime > 071500 and stime[1] < 071500)) then
Start = false;
If sdate == CurrentDate and (stime == 080000 or (stime > 080000 and stime[1] < 080000)) Then
Start = True;
If Start == true Then{
If C > O Then
buy("LE",AtStop,TimeHigh(084501,090000) + PriceScale,ordercnt);
If C < O Then
sell("SE",AtStop,TimeLow(084501,090000) - PriceScale,ordercnt);
#매수/매도 진입
#Buy("BUY",AtStop,TimeHigh(084501,090000) + PriceScale,ordercnt);
#Sell("SELL",AtStop,TimeLow(084501,090000) - PriceScale,ordercnt);
#스탑설정
If MarketPosition == 1 Then
ExitLong("스탑B",AtStop,TimeLow(084501,090000));
If MarketPosition == -1 Then
ExitShort("스탑S",AtStop,TimeHigh(084501,090000));
#트레일링 청산
If (MarketPosition == 1 or MarketPosition == -1) and CurrentContracts == MaxContracts Then
SetStopTrailing(1.5,4,PointStop,0);
#장마감전 청산
#SetStopEndofday(1515);
다음글
이전글