매수진입시간 시작 오전 9시1분에서 starttime(90100)
매수청산 시간을 오후 3시20분 endtime(152000);에 청산이 되도록 설정되어 있습니다
매수진입이 오전 9시 시작 오후 3시까지만 진입이 허용,
(매수청산 시간을 오후 3시20분 endtime(152000);에 청산)
오후 3시 이전 진입한 매수 포지션의경우 3시이후에는 매수청산 에 따라 Cond2 조건만족시
Exitlong("청산"); 되고, Cond2 조건만족하지 않을때에는 오후 3시20분 endtime(152000);에
청산 ExitLong("bx"); 되도록 원합니다
아래 1. 매수수식과 2. 예스스탁 작성 참고 하셔서 수식으로 작성 부탁 드립니다
1. 매수수식.
Input : period1(5),Period2(20);
Var : cond1(false),cond2(false);
Cond1 = Crossup(period1 ,period2);
Cond2 = Crossdown(period1 ,period2);
If Cond1 Then Buy("매수");
If Cond2 Then Exitlong("청산");
2. 예스스탁 작성.
input : starttime(90100),endtime(150000),xtime(152000);
var : Tcond(false);
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 (sdate != sdate[1] and stime >= xtime) or
(sdate == sdate[1] and stime >= xtime and stime[1] < xtime) then
{
if MarketPosition == 1 Then
ExitLong("bx");
}
즐거운 하루되세요
답변 1
예스스탁
예스스탁 답변
2020-01-08 18:14:54
안녕하세요
예스스탁입니다.
input : starttime(90000),endtime(150000),xtime(152000);
Input : period1(5),Period2(20);
Var : cond1(false),cond2(false);
var : Tcond(false);
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 (sdate != sdate[1] and stime >= xtime) or
(sdate == sdate[1] and stime >= xtime and stime[1] < xtime) then
{
if MarketPosition == 1 Then
ExitLong("bx");
}
Cond1 = Crossup(period1 ,period2);
Cond2 = Crossdown(period1 ,period2);
if Tcond == true and Cond1 == true Then
buy("매수");
if cond2 == true Then
exitlong("청산");
즐거운 하루되세요
> 뎅이요 님이 쓴 글입니다.
> 제목 : 매매시간 수식 확인부탁드립니다
> 매수진입시간 시작 오전 9시1분에서 starttime(90100)
매수청산 시간을 오후 3시20분 endtime(152000);에 청산이 되도록 설정되어 있습니다
매수진입이 오전 9시 시작 오후 3시까지만 진입이 허용,
(매수청산 시간을 오후 3시20분 endtime(152000);에 청산)
오후 3시 이전 진입한 매수 포지션의경우 3시이후에는 매수청산 에 따라 Cond2 조건만족시
Exitlong("청산"); 되고, Cond2 조건만족하지 않을때에는 오후 3시20분 endtime(152000);에
청산 ExitLong("bx"); 되도록 원합니다
아래 1. 매수수식과 2. 예스스탁 작성 참고 하셔서 수식으로 작성 부탁 드립니다
1. 매수수식.
Input : period1(5),Period2(20);
Var : cond1(false),cond2(false);
Cond1 = Crossup(period1 ,period2);
Cond2 = Crossdown(period1 ,period2);
If Cond1 Then Buy("매수");
If Cond2 Then Exitlong("청산");
2. 예스스탁 작성.
input : starttime(90100),endtime(150000),xtime(152000);
var : Tcond(false);
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 (sdate != sdate[1] and stime >= xtime) or
(sdate == sdate[1] and stime >= xtime and stime[1] < xtime) then
{
if MarketPosition == 1 Then
ExitLong("bx");
}
즐거운 하루되세요