커뮤니티
매매시간 설정 오류
2019-05-21 08:50:21
233
글번호 128829
예전에 알려주신 수식
매매시간 설정이있는데
이걸로 항셍을 매매하면 오류가 납니다
나스닥은 같은 수식으로 해도 괜찮습니다
Input : P(60),Period(20), sigPeriod(20), P2(470);
input : starttime(100000),endtime(015500);
Var : mav(0),mav2(0), sarv(0),Bcond(false),Scond(false);
var : Tcond(false);
mav = ma(c,P);
mav2= ma(c,P2);
value1 = TRIX(Period);
Value2 = ema(value1, sigPeriod);
if (sdate != sdate[1] and stime >= starttime) or
(sdate == sdate[1] and stime >= starttime and stime[1] < starttime) then
{
Tcond = true;
}
if (sdate != sdate[1] and stime >= endtime) or
(sdate == sdate[1] and stime >= endtime and stime[1] < endtime) then
{
Tcond = false;
if MarketPosition == 1 Then
ExitLong("매수시간청산");
if MarketPosition == -1 Then
ExitShort("매도시간청산");
}
이미지와 수식을 첨부합니다
나스닥은
090000 ~ 050000
으로 줘도 저렇게 오류나는일이 전혀없는데
항셍은 예전부터 이수식을 넣으면 종종 저런 상황이 생깁니다
100000 ~ 015500으로요
오류원인과 수정 부탁드려요
Bcond = C > mav and value1 > value1[1] ;
Scond = C < mav and value1 < value1[1];
if Tcond == true then
{
if Bcond == true and C > mav and Bcond[1] == false Then
buy("매수진입");
if Scond == true and C < mav and Scond[1] == false Then
sell("매도진입");
}
수식은 이건데
- 1. 129432_CurrentChart.jpg (0.44 MB)
답변 1
예스스탁 예스스탁 답변
2019-05-21 13:52:26
안녕하세요
예스스탁입니다.
말씀하신 오류는 endtime과 관련된 내용인것 같습니다.
수식에서 지정한 시간은 01시55분인데
01시 이후에 거래가 없는 날들이 있습니다.
아마 토요일새벽인것 같습니다.
토요일새벽은 0시 50분에 청산하고
나머지는 1시 50분에 청산하게 수정해 드립니다.
Input : P(60),Period(20), sigPeriod(20), P2(470);
input : starttime(100000),endtime1(015000),endtime2(005000);
Var : mav(0),mav2(0), sarv(0),Bcond(false),Scond(false);
var : Tcond(false);
mav = ma(c,P);
mav2= ma(c,P2);
value1 = TRIX(Period);
Value2 = ema(value1, sigPeriod);
if (sdate != sdate[1] and stime >= starttime) or
(sdate == sdate[1] and stime >= starttime and stime[1] < starttime) then
{
Tcond = true;
}
if DayOfWeek(sdate) != 6 then
{
if (sdate != sdate[1] and stime >= endtime1) or
(sdate == sdate[1] and stime >= endtime1 and stime[1] < endtime1) then
{
Tcond = false;
if MarketPosition == 1 Then
ExitLong("매수시간청산1");
if MarketPosition == -1 Then
ExitShort("매도시간청산1");
}
}
if DayOfWeek(sdate) == 6 then
{
if (sdate != sdate[1] and stime >= endtime2) or
(sdate == sdate[1] and stime >= endtime2 and stime[1] < endtime2) then
{
Tcond = false;
if MarketPosition == 1 Then
ExitLong("매수시간청산2");
if MarketPosition == -1 Then
ExitShort("매도시간청산2");
}
}
Bcond = C > mav and value1 > value1[1] ;
Scond = C < mav and value1 < value1[1];
if Tcond == true then
{
if Bcond == true and C > mav and Bcond[1] == false Then
buy("매수진입");
if Scond == true and C < mav and Scond[1] == false Then
sell("매도진입");
}
즐거운 하루되세요
> 쩜상쩜하 님이 쓴 글입니다.
> 제목 : 매매시간 설정 오류
> 예전에 알려주신 수식
매매시간 설정이있는데
이걸로 항셍을 매매하면 오류가 납니다
나스닥은 같은 수식으로 해도 괜찮습니다
Input : P(60),Period(20), sigPeriod(20), P2(470);
input : starttime(100000),endtime(015500);
Var : mav(0),mav2(0), sarv(0),Bcond(false),Scond(false);
var : Tcond(false);
mav = ma(c,P);
mav2= ma(c,P2);
value1 = TRIX(Period);
Value2 = ema(value1, sigPeriod);
if (sdate != sdate[1] and stime >= starttime) or
(sdate == sdate[1] and stime >= starttime and stime[1] < starttime) then
{
Tcond = true;
}
if (sdate != sdate[1] and stime >= endtime) or
(sdate == sdate[1] and stime >= endtime and stime[1] < endtime) then
{
Tcond = false;
if MarketPosition == 1 Then
ExitLong("매수시간청산");
if MarketPosition == -1 Then
ExitShort("매도시간청산");
}
이미지와 수식을 첨부합니다
나스닥은
090000 ~ 050000
으로 줘도 저렇게 오류나는일이 전혀없는데
항셍은 예전부터 이수식을 넣으면 종종 저런 상황이 생깁니다
100000 ~ 015500으로요
오류원인과 수정 부탁드려요
Bcond = C > mav and value1 > value1[1] ;
Scond = C < mav and value1 < value1[1];
if Tcond == true then
{
if Bcond == true and C > mav and Bcond[1] == false Then
buy("매수진입");
if Scond == true and C < mav and Scond[1] == false Then
sell("매도진입");
}
수식은 이건데
다음글
이전글