커뮤니티
maxpositionprofit과 청산
2011-01-05 12:17:04
619
글번호 34719
예컨데 현재 포지션의 최대수익이 10% 이상되면, 현재 포지션의 50%를 청산하고,
나머지 포지션은 최대수익 대비 15% 이상 하락하면, 모두 청산되도록
하는 식을 작성할 수 없어서 글 올립니다. 왕초보라서요. 부탁드립니다.
답변 1
예스스탁 예스스탁 답변
2011-01-05 17:05:07
안녕하세요
예스스탁입니다.
if MarketPosition == 1 Then{
if CurrentContracts == MaxContracts Then
exitlong("bx1",atlimit,EntryPrice*1.1,"",Int(CurrentContracts*0.5),1);
if CurrentContracts < MaxContracts and highest(H,BarsSinceEntry) >= EntryPrice*1.1 Then
exitlong("bx2",atlimit,highest(H,BarsSinceEntry)*0.85);
}
if MarketPosition == -1 Then{
if CurrentContracts == MaxContracts Then
ExitShort("sx1",atlimit,EntryPrice*0.9,"",Int(CurrentContracts*0.5),1);
if CurrentContracts < MaxContracts and Lowest(L,BarsSinceEntry) <= EntryPrice*0.9 Then
ExitShort("sx2",atlimit,Lowest(L,BarsSinceEntry)*1.15);
}
즐거운 하루되세요
> 전나무아래 님이 쓴 글입니다.
> 제목 : maxpositionprofit과 청산
> 예컨데 현재 포지션의 최대수익이 10% 이상되면, 현재 포지션의 50%를 청산하고,
나머지 포지션은 최대수익 대비 15% 이상 하락하면, 모두 청산되도록
하는 식을 작성할 수 없어서 글 올립니다. 왕초보라서요. 부탁드립니다.
이전글