커뮤니티
피라미딩순 청산
2020-01-20 11:47:53
197
글번호 130663
피라미딩 설정후 아래 수식을 일반적으로 사용하고 있습니다.
아래 설정대로면 총 3번의 진입이 발생합니다.
첫번째 진입은 수식의 전략대로 진입하며,
두번째 진입과 세번째는 변동폭에 따라 진입합니다.
요청내용) 진입순서별로 구분하여 손절할 수 있는 수식을 요청합니다.
1st 진입의 손절
2nd 진입의 손절
3th 진입의 손절
항상 고맙습니다.
************************************************************************************
1) buy만 거래하는 수식
input : 변동폭(0.50),수량(3);
if MarketPosition == 1 and MaxContracts < 수량 Then
buy("bb",AtStop,LatestEntryPrice(0)+변동폭);
2)sell만 거래하는 수식
input : 변동폭(0.50),수량(3) ;
if MarketPosition == -1 and MaxContracts < 수량 Then
sell("ss",AtStop,LatestEntryPrice(0)-변동폭);
답변 1
예스스탁 예스스탁 답변
2019-07-26 14:13:38
안녕하세요
예스스탁입니다.
1
input : 변동폭(0.50),수량(3),손절1(0.5),손절2(0.5),손절3(0.5);
var : xCond1(false),xCond2(false),xCond3(false);
Array : EP[10](0);
if MarketPosition == 1 and MaxContracts < 수량 Then
buy("bb",AtStop,LatestEntryPrice(0)+변동폭);
if MarketPosition == 1 then
{
EP[MaxEntries] = LatestEntryPrice(0);
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "bl1" Then
xCond1 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "bl2" Then
xCond2 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "bl3" Then
xCond3= true;
#진입이 1회이상 발생후
if MaxEntries >= 1 and xCond1 == false Then
ExitLong("bl1",AtStop,EP[1]-손절1,"",1,1);
#진입이 2회이상 발생후
if MaxEntries >= 2 and xCond2 == false Then
ExitLong("bl2",AtStop,EP[2]-손절2,"",1,1);
#진입이 3회이상 발생후
if MaxEntries >= 3 and xCond3 == false Then
ExitLong("bl3",AtStop,EP[3]-손절3,"",1,1);
}
Else
{
xCond1 = false;
xCond2 = false;
xCond3 = false;
}
2
input : 변동폭(0.50),수량(3),손절1(0.5),손절2(0.5),손절3(0.5);
var : xCond1(false),xCond2(false),xCond3(false);
Array : EP[10](0);
if MarketPosition == -1 and MaxContracts < 수량 Then
sell("ss",AtStop,LatestEntryPrice(0)-변동폭);
if MarketPosition == -1 then
{
EP[MaxEntries] = LatestEntryPrice(0);
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "sl1" Then
xCond1 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "sl2" Then
xCond2 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "sbl3" Then
xCond3= true;
#진입이 1회이상 발생후
if MaxEntries >= 1 and xCond1 == false Then
ExitShort("sl1",AtStop,EP[1]+손절1,"",1,1);
#진입이 2회이상 발생후
if MaxEntries >= 2 and xCond2 == false Then
ExitShort("sl2",AtStop,EP[2]+손절2,"",1,1);
#진입이 3회이상 발생후
if MaxEntries >= 3 and xCond3 == false Then
ExitShort("sl3",AtStop,EP[3]+손절3,"",1,1);
}
Else
{
xCond1 = false;
xCond2 = false;
xCond3 = false;
}
즐거운 하루되세요
> 목마와숙녀 님이 쓴 글입니다.
> 제목 : 문의
>
피라미딩 설정후 아래 수식을 일반적으로 사용하고 있습니다.
아래 설정대로면 총 3번의 진입이 발생합니다.
첫번째 진입은 수식의 전략대로 진입하며,
두번째 진입과 세번째는 변동폭에 따라 진입합니다.
요청내용) 진입순서별로 구분하여 손절할 수 있는 수식을 요청합니다.
1st 진입의 손절
2nd 진입의 손절
3th 진입의 손절
항상 고맙습니다.
************************************************************************************
1) buy만 거래하는 수식
input : 변동폭(0.50),수량(3);
if MarketPosition == 1 and MaxContracts < 수량 Then
buy("bb",AtStop,LatestEntryPrice(0)+변동폭);
2)sell만 거래하는 수식
input : 변동폭(0.50),수량(3) ;
if MarketPosition == -1 and MaxContracts < 수량 Then
sell("ss",AtStop,LatestEntryPrice(0)-변동폭);