커뮤니티
기본 이평으로 분할청산을 하고싶습니다.
2016-12-30 10:36:06
130
글번호 105455
Input : shortPeriod(5), longPeriod(20);
value1 = ma(C, shortPeriod);
value2 = ma(C, longPeriod);
# 매수/매도청산
If CrossUP(value1, value2) Then
{
Buy();
}
# 매도/매수청산
If CrossDown(value1, value2) Then
{
Sell();
}
요기서 진입가에 1차로 10틱 청산 2차로20틱 3차로 50틱
요렇게 하고싶은데 가능한지요?
답변 1
예스스탁 예스스탁 답변
2017-01-02 10:38:09
안녕하세요
예스스탁입니다.
3분할 청산이므로 수량이 최소 3주(계약) 이상이어야 합니다.
1/3씩 청산되게 작성했습니다.
Input : shortPeriod(5), longPeriod(20);
value1 = ma(C, shortPeriod);
value2 = ma(C, longPeriod);
# 매수/매도청산
If CrossUP(value1, value2) Then
{
Buy();
}
# 매도/매수청산
If CrossDown(value1, value2) Then
{
Sell();
}
if MarketPosition == 1 Then{
exitlong("bp1",atlimit,EntryPrice+PriceScale*10,"",floor(MaxContracts*(1/3)),1);
exitlong("bp2",atlimit,EntryPrice+PriceScale*20,"",floor(MaxContracts*(1/3)),1);
exitlong("bp3",atlimit,EntryPrice+PriceScale*30);
}
if MarketPosition == -1 Then{
ExitShort("sp1",atlimit,EntryPrice-PriceScale*10,"",floor(MaxContracts*(1/3)),1);
ExitShort("sp2",atlimit,EntryPrice-PriceScale*20,"",floor(MaxContracts*(1/3)),1);
ExitShort("sp3",atlimit,EntryPrice-PriceScale*30);
}
즐거운 하루되세요
> 추노선물 님이 쓴 글입니다.
> 제목 : 기본 이평으로 분할청산을 하고싶습니다.
> Input : shortPeriod(5), longPeriod(20);
value1 = ma(C, shortPeriod);
value2 = ma(C, longPeriod);
# 매수/매도청산
If CrossUP(value1, value2) Then
{
Buy();
}
# 매도/매수청산
If CrossDown(value1, value2) Then
{
Sell();
}
요기서 진입가에 1차로 10틱 청산 2차로20틱 3차로 50틱
요렇게 하고싶은데 가능한지요?