예스스탁
예스스탁 답변
2022-05-30 14:18:43
안녕하세요
예스스탁입니다.
1
예 5계약으로 모두 지정되어 있습니다.
적용시 피라미딩만 모든진입신호허용으로 설정하고 적용하시면 됩니다.
2
랭귀지에서 분할은 봉단위로만 분할하게 작성해 드릴수 있습니다
청산조건이 만족하면 5계약 청산하고 더이상 추가진입이 되지 않게 막고
이후 매봉 종가에 5계약씩 분할로 청산합니다
if C > A Then{
t=1;
if MarketPosition() == 0 and t==1 Then
buy("매수", OnClose,def,5 );
}
if C < B Then {
t=-1 ;
if MarketPosition() ==0 and t==-1 Then
Sell("매도",OnClose,def,5);
}
if MarketPosition == 1 Then
{
if Condition1 == False and CurrentContracts < CurrentContracts[1] Then
Condition1 = true;
if Condition1 == False Then
{
buy("bb",AtStop,LatestEntryPrice(0)+PriceScale*매수간격,5 );
if MaxEntries == 1 Then
ExitLong("매수1손절",AtStop,C-PriceScale*손절변수);
if MaxEntries >= 2 Then
ExitLong("bx",AtStop,D);
ExitLong("매수이익x",AtLimit,D+PriceScale*이익변수 );
}
Else
{
#청산신호 나오면 이후 매봉 종가에 5계약씩 청산
ExitLong("bx1",OnClose,Def,"",5,2);
}
}
Else
Condition1 = False;
if MarketPosition == -1 Then
{
if Condition2 == False and CurrentContracts < CurrentContracts[1] Then
Condition2 = true;
if Condition2 == False Then
{
Sell("ss",AtStop,LatestEntryPrice(0)-PriceScale*매도간격,5);
if MaxEntries == 1 Then
ExitShort("매도1손절",AtStop,F+PriceScale*손절변수 );
if MaxEntries >= 2 Then
ExitShort("sx",AtStop,G);
ExitShort("매도이익",AtLimit,G-PriceScale*이익변수);
}
Else
{
#청산신호 나오면 이후 매봉 종가에 5계약씩 청산
ExitShort("sx1",OnClose,Def,"",5,2);
}
}
Else
Condition2 = False;
즐거운 하루되세요
> 종호 님이 쓴 글입니다.
> 제목 : 문의드립니다.
> 아래수식은 피라미딩으로 5계약씩 계속 진입이 되도록 한 것인데 제가 맞게 한 것인지요?
잘못 되었으면 수정 부탁드리고요.
또 많은 수의 수량이 축적이 되므로
청산시 많은 양을 시장가로 한번에 청산하기에는 버겁습니다.
청산 신호가 나오면 분할로 나누어서 청산을 해야할 것 같은데 어떻게
하면 좋겠습니까?
수식을 부탁드립니다.
if C > A Then{
t=1;
if MarketPosition() == 0 and t==1 Then
buy("매수", OnClose,def,5 );
}
if C < B Then {
t=-1 ;
if MarketPosition() ==0 and t==-1 Then
Sell("매도",OnClose,def,5);
}
if MarketPosition == 1 Then
{
buy("bb",AtStop,LatestEntryPrice(0)+PriceScale*매수간격,5 );
if MaxEntries == 1 Then
ExitLong("매수1손절",AtStop,C-PriceScale*손절변수);
if MaxEntries >= 2 Then
ExitLong("bx",AtStop,D);
ExitLong("매수이익x",AtLimit,D+PriceScale*이익변수 );
}
if MarketPosition == -1 Then
{
Sell("ss",AtStop,LatestEntryPrice(0)-PriceScale*매도간격,5);
if MaxEntries == 1 Then
ExitShort("매도1손절",AtStop,F+PriceScale*손절변수 );
if MaxEntries >= 2 Then
ExitShort("sx",AtStop,G);
ExitShort("매도이익",AtLimit,G-PriceScale*이익변수);
}