커뮤니티
거래종료 수식부탁드립니다.
2019-02-20 13:11:03
125
글번호 126365
해외선물 크루드 오일을 거래중인데 당일 누적 손실이 50틱 이상이면 더이상 진입이 되지 않게 하는(당일거래종료) 수식을 알고 싶습니다.
정말 초보라 아무것도 모르겠습니다. T.T
거래 시간대는 2파트로 나눠져 있습니다.
11:00~15:00
17:00~23:30
각각1개의 파일에 매수,청산 매도,청산의 조건이 들어 있습니다.
그리고
아래수식에서
각각 별개의 파일에 매수,청산 매도,청산이 있으므로
매수에는
if Xcond == false then{
if 매수진입조건 Then{
buy("b");}
을
넣으면 되는데 매수진입조건에는 무엇을 입력해야 하나요? 각각 시간별로 매수진입이 있으므로 시작시간과 종료시간을 같이 적용하여 진입조건만 넣으면 되는건지? 청산 조건도 같이 넣어야 하는지 알고 싶고 buy("b")를 왜 설정하는지요?
초보라서 죄송합니다.
Input : 당일손실틱수(50);
Var : N1(0),dayPl(0),당일손실(0),Xcond(false);
당일손실 = PriceScale*당일손실틱수;
if Bdate != Bdate[1] Then{
Xcond = false;
N1 = NetProfit[1];
}
daypl = NetProfit-N1;
if TotalTrades > TotalTrades[1] and
(IsExitName("dbp",1) == true or IsExitName("dbl",1) == true or
IsExitName("dsp",1) == true or IsExitName("dsl",1) == true) then
Xcond = true;
if Xcond == false then{
if 매수진입조건 Then{
buy("b");
}
if 매도진입조건 Then{
sell("s");
}
}
if MarketPosition == 1 then{
ExitLong("dbl",AtStop,EntryPrice-((당일손실+daypl)/CurrentContracts));
}
if MarketPosition == -1 then{
ExitShort("dsl",AtStop,EntryPrice+((당일손실+daypl)/CurrentContracts));
}
답변 1
예스스탁 예스스탁 답변
2019-02-20 14:30:41
안녕하세요
예스스탁입니다.
매수진입조건, 매도진입조건은 진입조건을 넣으시면 됩니다.
시간이나 당일손실은 Xcond와 Tcond로 제어됩니다.
Input : 당일손실틱수(50);
input : start1(110000),end1(150000);
input : start2(170000),end2(233000);
Var : N1(0),dayPl(0),당일손실(0),Xcond(false);
var : Tcond(false);
if Bdate != Bdate[1] Then
{
Xcond = false;
N1 = NetProfit[1];
}
if (sdate != sdate[1] and stime >= start1) or
(sdate == sdate[1] and stime >= start1 and stime[1] < start1) then
{
Tcond = true;
}
if (sdate != sdate[1] and stime >= end1) or
(sdate == sdate[1] and stime >= end1 and stime[1] < end1) then
{
Tcond = false;
}
if (sdate != sdate[1] and stime >= start2) or
(sdate == sdate[1] and stime >= start2 and stime[1] < start2) then
{
Tcond = true;
}
if (sdate != sdate[1] and stime >= end2) or
(sdate == sdate[1] and stime >= end2 and stime[1] < end2) then
{
Tcond = false;
}
당일손실 = PriceScale*당일손실틱수;
daypl = NetProfit-N1;
if TotalTrades > TotalTrades[1] and
(IsExitName("dbl",1) == true or
IsExitName("dsl",1) == true or
daypl <= -당일손실) then
Xcond = true;
if Xcond == false and Tcond == true then
{
if 매수진입조건 Then{
buy("b");
}
if 매도진입조건 Then{
sell("s");
}
}
if MarketPosition == 1 then{
ExitLong("dbl",AtStop,EntryPrice-((당일손실+daypl)/CurrentContracts));
}
if MarketPosition == -1 then{
ExitShort("dsl",AtStop,EntryPrice+((당일손실+daypl)/CurrentContracts));
}
즐거운 하루되세요
> 에쓰엠씨 님이 쓴 글입니다.
> 제목 : 거래종료 수식부탁드립니다.
> 해외선물 크루드 오일을 거래중인데 당일 누적 손실이 50틱 이상이면 더이상 진입이 되지 않게 하는(당일거래종료) 수식을 알고 싶습니다.
정말 초보라 아무것도 모르겠습니다. T.T
거래 시간대는 2파트로 나눠져 있습니다.
11:00~15:00
17:00~23:30
각각1개의 파일에 매수,청산 매도,청산의 조건이 들어 있습니다.
그리고
아래수식에서
각각 별개의 파일에 매수,청산 매도,청산이 있으므로
매수에는
if Xcond == false then{
if 매수진입조건 Then{
buy("b");}
을
넣으면 되는데 매수진입조건에는 무엇을 입력해야 하나요? 각각 시간별로 매수진입이 있으므로 시작시간과 종료시간을 같이 적용하여 진입조건만 넣으면 되는건지? 청산 조건도 같이 넣어야 하는지 알고 싶고 buy("b")를 왜 설정하는지요?
초보라서 죄송합니다.
Input : 당일손실틱수(50);
Var : N1(0),dayPl(0),당일손실(0),Xcond(false);
당일손실 = PriceScale*당일손실틱수;
if Bdate != Bdate[1] Then{
Xcond = false;
N1 = NetProfit[1];
}
daypl = NetProfit-N1;
if TotalTrades > TotalTrades[1] and
(IsExitName("dbp",1) == true or IsExitName("dbl",1) == true or
IsExitName("dsp",1) == true or IsExitName("dsl",1) == true) then
Xcond = true;
if Xcond == false then{
if 매수진입조건 Then{
buy("b");
}
if 매도진입조건 Then{
sell("s");
}
}
if MarketPosition == 1 then{
ExitLong("dbl",AtStop,EntryPrice-((당일손실+daypl)/CurrentContracts));
}
if MarketPosition == -1 then{
ExitShort("dsl",AtStop,EntryPrice+((당일손실+daypl)/CurrentContracts));
}