예스스탁
예스스탁 답변
2020-11-18 15:54:57
안녕하세요
예스스탁입니다.
1
진입신호만 반대로 변경하시면 아래와 같습니다.
input: 진입(2),청산(13),이동평균선(10),losscnt(3);
var : hh(0),ll(0),mav(0),profit(0),loss(0),cnt(0),entrynum(0);
#손실횟수 계산
loss = 0;
if ExitDate(3) != sDate Then
loss = 0;
Else
{
for cnt = 1 to 3
{
if PositionProfit(cnt) < 0 Then
loss = loss + 1 ;
}
}
#청산
ExitLong("EL", atstop, Lowest( Low , 청산));
ExitShort("ES", atstop,Highest( High , 청산));
hh = Highest(h,진입);
ll = Lowest(l,진입);
mav = ma(C,이동평균선);
if ( stime >= 103000 and stime < 160000 ) and loss < losscnt Then
{
if c > mav and c > hh[1] Then
Sell();
if c < mav and c < ll[1] Then
Buy();
}
2
진입이 반대로 됨에 따라 청산도 반대로 변경하시고자 하시면 아래와 같습니다.
input: 진입(2),청산(13),이동평균선(10),losscnt(3);
var : hh(0),ll(0),mav(0),profit(0),loss(0),cnt(0),entrynum(0);
#손실횟수 계산
loss = 0;
if ExitDate(3) != sDate Then
loss = 0;
Else
{
for cnt = 1 to 3
{
if PositionProfit(cnt) < 0 Then
loss = loss + 1 ;
}
}
#청산
ExitShort("EL", AtLimit, Lowest( Low , 청산));
ExitLong("ES", AtLimit,Highest( High , 청산));
hh = Highest(h,진입);
ll = Lowest(l,진입);
mav = ma(C,이동평균선);
if ( stime >= 103000 and stime < 160000 ) and loss < losscnt Then
{
if c > mav and c > hh[1] Then
Sell();
if c < mav and c < ll[1] Then
Buy();
}
즐거운 하루되세요
> 산이보리 님이 쓴 글입니다.
> 제목 : 수식 의뢰 부탁드립니다.
> 개발자님의 노고에 감사드립니다
아래 로직의 진입방향을 바꾸고 싶습니다
매수진입을를 매도로, 매도진입를 매수로는 변경할 수 있는데 청산조건을 반대로 변경하질 못하고 있어요
감사합니다
----------
input: 진입(2),청산(13),이동평균선(10),losscnt(3);
var : hh(0),ll(0),mav(0),profit(0),loss(0),cnt(0),entrynum(0);
#손실횟수 계산
loss = 0;
if ExitDate(3) != sDate Then
loss = 0;
Else
{
for cnt = 1 to 3
{
if PositionProfit(cnt) < 0 Then
loss = loss + 1 ;
}
}
#청산
ExitLong("EL", atstop, Lowest( Low , 청산));
ExitShort("ES", atstop,Highest( High , 청산));
hh = Highest(h,진입);
ll = Lowest(l,진입);
mav = ma(C,이동평균선);
if ( stime >= 103000 and stime < 160000 ) and loss < losscnt Then
{
if c > mav and c > hh[1] Then
Buy();
if c < mav and c < ll[1] Then
Sell();
}