커뮤니티
특정시간에 분할청산될수 있도록 할수있는 수식이요...
2018-10-17 21:42:24
137
글번호 122768
endtime에 청산하는 수식인데요...
진입을 1개를 하든 2개를 하든 3개를 하든 해당시간(endtime)에 모두 청산되는데요..
만약 1개 진입시에는 endtime(A) 2개진입시에는 endtime(A) endtime(B)에
3개진입시에는 enditme(A),enditme(B),enditme(C) 에 각각 한계약시 분할 청산될수있는 수식을
알려주시면 감사합니다.
예_) A: 143000 B:150000 C:153000 2시30분에 1계약 청산 3시 1계약청산 3시30분 1계약청산
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;
SetStopEndofday(0);#해제
}
if (sdate != sdate[1] and stime >= endtime) or
(sdate == sdate[1] and stime >= endtime and stime[1] < endtime) then
{
Tcond = false;
}
답변 1
예스스탁 예스스탁 답변
2018-10-18 13:49:28
안녕하세요
예스스탁입니다.
시간을 지정해 분할청산하기 위해서는
if문으로 조건이 지정되어야 하고 봉완성시로만 가능합니다.
plot1(stime);
위 지표로 지정한 시간의 봉이 있는지 확인하셔야 합니다.
input : endtime1(143000),endtime2(150000),endtime3(153000);
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 >= endtime1) or
(sdate == sdate[1] and stime >= endtime1 and stime[1] < endtime1) then
{
Tcond = false;
if MarketPosition == 1 Then
ExitLong("bx1",OnClose,def,"",1,1);
if MarketPosition == -1 Then
ExitShort("sx1",OnClose,def,"",1,1);
}
if (sdate != sdate[1] and stime >= endtime2) or
(sdate == sdate[1] and stime >= endtime2 and stime[1] < endtime2) then
{
if MarketPosition == 1 Then
ExitLong("bx2",OnClose,def,"",1,1);
if MarketPosition == -1 Then
ExitShort("sx2",OnClose,def,"",1,1);
}
if (sdate != sdate[1] and stime >= endtime3) or
(sdate == sdate[1] and stime >= endtime3 and stime[1] < endtime3) then
{
Tcond = false;
if MarketPosition == 1 Then
ExitLong("bx3",OnClose,def,"",1,1);
if MarketPosition == -1 Then
ExitShort("sx3",OnClose,def,"",1,1);
}
즐거운 하루되세요
> 이형지 님이 쓴 글입니다.
> 제목 : 특정시간에 분할청산될수 있도록 할수있는 수식이요...
> endtime에 청산하는 수식인데요...
진입을 1개를 하든 2개를 하든 3개를 하든 해당시간(endtime)에 모두 청산되는데요..
만약 1개 진입시에는 endtime(A) 2개진입시에는 endtime(A) endtime(B)에
3개진입시에는 enditme(A),enditme(B),enditme(C) 에 각각 한계약시 분할 청산될수있는 수식을
알려주시면 감사합니다.
예_) A: 143000 B:150000 C:153000 2시30분에 1계약 청산 3시 1계약청산 3시30분 1계약청산
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;
SetStopEndofday(0);#해제
}
if (sdate != sdate[1] and stime >= endtime) or
(sdate == sdate[1] and stime >= endtime and stime[1] < endtime) then
{
Tcond = false;
}