커뮤니티
breakeven, 피라미딩 문의
2019-05-01 12:21:38
240
글번호 128298
안녕하세요, 유진에서 해외선물을 거래하고 있습니다.
피라미딩 전략으로 누적 포지션이 총 3개인 전략이 있다고 할때, entryprice 함수를 사용하여 breakeven 전략을 구현하였는데 entryprice 값은 최초에 포지션 진입이 이루어진 진입 가격을 가지고 오는것 같습니다. (marketposition이 0에서 1로 전환될시)
만약 첨부된 사진과 같이 피라미딩으로 진입된 포지션도 각각 진입한 가격에 따라 breakeven 청산을 하고자 한다면 어떻게 시스템식을 작성 해야할까요? (사진은 Tradestation에서 내제되어 있는 breakeven 함수를 사용 하였습니다)
감사합니다.
breakeven 함수는 아래와 같이 구현하였습니다.
If condition3 then begin
if MarketPosition == 1 then begin
if close > EntryPrice then begin
ExitLong("BreakevenBS",AtStop,EntryPrice);
end
else begin
ExitLong("BreakevenBL",Atlimit,EntryPrice+0.03);
end ;
end;
if MarketPosition == -1 then begin
if close < EntryPrice then begin
ExitShort("BreakevenSS",AtStop,EntryPrice);
end
else begin
ExitShort("BreakevenSL",Atlimit,EntryPrice);
end ;
end;
end ;
- 1. K-027.jpg (0.03 MB)
답변 1
예스스탁 예스스탁 답변
2019-05-02 11:49:34
안녕하세요
예스스탁입니다.
entryprice는 포지션의 첫진입 가격입니다.
진입별로 별도로 변수에 진입별가격과 수량 지정해 청산하셔야 합니다.
var : E1(0),V1(0),Xcond1(false);
var : E2(0),V2(0),Xcond2(false);
var : E3(0),V3(0),Xcond3(false);
if MarketPosition == 1 Then
{
if CurrentContracts > CurrentContracts[1] then
{
if MaxEntries == 1 then
{
E1 = LatestEntryPrice(0);
V1 = CurrentContracts-CurrentContracts[1];
Xcond1 = true;
}
if MaxEntries == 2 then
{
E2 = LatestEntryPrice(0);
V2 = CurrentContracts-CurrentContracts[1];
Xcond2 = true;
}
if MaxEntries == 3 then
{
E3 = LatestEntryPrice(0);
V3 = CurrentContracts-CurrentContracts[1];
Xcond3 = true;
}
}
if CurrentContracts < CurrentContracts[1] then
{
if LatestExitName(0) == "bx1" Then
Xcond1 = false;
if LatestExitName(0) == "bx2" Then
Xcond2 = false;
if LatestExitName(0) == "bx3" Then
Xcond3 = false;
}
if Xcond1 == true and L > E1 then
{
ExitLong("bx1",AtStop,E1,"",V2,1);
}
if Xcond2 == true and L > E2 then
{
ExitLong("bx2",AtStop,E2,"",V2,1);
}
if Xcond3 == true and L > E3 then
{
ExitLong("bx3",AtStop,E3,"",V3,1);
}
}
else
{
Xcond1 = false;
Xcond2 = false;
Xcond3 = false;
}
즐거운 하루되세요
> 라면의비밀 님이 쓴 글입니다.
> 제목 : breakeven, 피라미딩 문의
> 안녕하세요, 유진에서 해외선물을 거래하고 있습니다.
피라미딩 전략으로 누적 포지션이 총 3개인 전략이 있다고 할때, entryprice 함수를 사용하여 breakeven 전략을 구현하였는데 entryprice 값은 최초에 포지션 진입이 이루어진 진입 가격을 가지고 오는것 같습니다. (marketposition이 0에서 1로 전환될시)
만약 첨부된 사진과 같이 피라미딩으로 진입된 포지션도 각각 진입한 가격에 따라 breakeven 청산을 하고자 한다면 어떻게 시스템식을 작성 해야할까요? (사진은 Tradestation에서 내제되어 있는 breakeven 함수를 사용 하였습니다)
감사합니다.
breakeven 함수는 아래와 같이 구현하였습니다.
If condition3 then begin
if MarketPosition == 1 then begin
if close > EntryPrice then begin
ExitLong("BreakevenBS",AtStop,EntryPrice);
end
else begin
ExitLong("BreakevenBL",Atlimit,EntryPrice+0.03);
end ;
end;
if MarketPosition == -1 then begin
if close < EntryPrice then begin
ExitShort("BreakevenSS",AtStop,EntryPrice);
end
else begin
ExitShort("BreakevenSL",Atlimit,EntryPrice);
end ;
end;
end ;