커뮤니티
포지션 관련해서 문의 드립니다.
2013-08-08 17:00:57
170
글번호 66250
현재 진입중인 포지션중에 제일 높은 가격의 포지션을 찾는 방법과
현재 진입중인 포지션중에 제일 낮은 가격의 포지션을 찾는 방법을
수식으로 부탁드립니다.
즐거운 하루 되세요^^
답변 1
예스스탁 예스스탁 답변
2013-08-08 17:23:34
안녕하세요
예스스탁입니다.
var : Bcnt(0),BmaxPrice(0),Scnt(0),SmaxPrice(0);
if MarketPosition == 1 Then{
if CurrentContracts > CurrentContracts[1] Then{
if countif(CurrentContracts > CurrentContracts[1],BarsSinceEntry) == 1 Then{
Bcnt = 1;
BmaxPrice = EntryPrice;
}
if countif(CurrentContracts > CurrentContracts[1],BarsSinceEntry) >= 2 and
C[1] > BmaxPrice Then{
Bcnt = countif(CurrentContracts > CurrentContracts[1],BarsSinceEntry);
BmaxPrice = C[1];
}
}
}
if MarketPosition == 1 Then{
if CurrentContracts > CurrentContracts[1] Then{
if countif(CurrentContracts > CurrentContracts[1],BarsSinceEntry) == 1 Then{
Scnt = 1;
SmaxPrice = EntryPrice;
}
if countif(CurrentContracts > CurrentContracts[1],BarsSinceEntry) >= 2 and
C[1] < SmaxPrice Then{
Scnt = countif(CurrentContracts > CurrentContracts[1],BarsSinceEntry);
SmaxPrice = C[1];
}
}
}
피라미딩으로 추가진입된 부분은 따로 값을 리턴하는 함수가 없어
위와 같이 값을 저정해 비교하셔야 합니다.
위식은 모든 진입이 onclose로 진입했을 경우입니다.
Bcnt는 매수진입후 가장높은 가격의 진입이 몇번째 진입인지 저장하는 변수이며 BmaxPrice는 그 진입가입니다.
Scnt는 매도진입후 가장낮은 가격의 진입이 몇번째 진입인지 저장하는 변수이며 BmaxPrice는 그 진입가입니다.
즐거운 하루되세요
> 무결점 님이 쓴 글입니다.
> 제목 : 포지션 관련해서 문의 드립니다.
> 현재 진입중인 포지션중에 제일 높은 가격의 포지션을 찾는 방법과
현재 진입중인 포지션중에 제일 낮은 가격의 포지션을 찾는 방법을
수식으로 부탁드립니다.
즐거운 하루 되세요^^