예스스탁
예스스탁 답변
2022-05-09 10:52:07
안녕하세요
예스스탁입니다.
1
var: t(0);
input : period(20),period2(20),매수간격(100),매도간격(100) ;
input: 이익변수(560),손절변수(420);
var : HH(0),LL(0);
중략~~~~~~~~~
if MarketPosition == 1 Then
{
buy("bb",AtStop,LatestEntryPrice(0)+PriceScale*매수간격);
if MaxEntries == 1 Then
ExitLong("매수1손절",AtStop,EntryPrice-PriceScale*손절변수);
if CurrentContracts > CurrentContracts[1] Then
HH = H;
if H > HH Then
HH = H;
if MaxEntries >= 2 Then
ExitLong("bx",AtStop,HH-abs(HH-AvgEntryPrice)*0.2);
}
if MarketPosition == -1 Then
{
Sell("ss",AtStop,LatestEntryPrice(0)-PriceScale*매도간격);
if MaxEntries == 1 Then
ExitShort("매도1손절",AtStop,EntryPrice+PriceScale*손절변수 );
if CurrentContracts > CurrentContracts[1] Then
LL = L;
if L < LL Then
LL = H;
if MaxEntries >= 2 and Then
ExitShort("sx",AtStop,LL+abs(LL-AvgEntryPrice)*0.2);
}
2
예 맞습니다.
MaxEntries가 진행중인 포지션의 최대진입회수이므로
청산완료되면 0으로 변경됩니다.
즐거운 하루되세요
> 종호 님이 쓴 글입니다.
> 제목 : 문의드립니다.
> 아래수식에서
매수 포지션에서 매수가 2단계 이상 이루어지면
if MaxEntries >= 2 Then
ExitLong("bx",AtStop,AvgEntryPrice);
인데요.,
여기에 이 때 최고수익에서 20% 가 내려 오면 AvgEntryPrice까지 내려오기 전에
청산되는 수식을 추가 하고 싶습니다.
또 반대 논리로 if MaxEntries >= 2 Then
ExitShort("sx",AtStop,AvgEntryPrice);
매도포지션도 부탁드립니다.
즉 매도 2단계 이상에서
최고수익에서 20% 가 내려 오면 AvgEntryPrice까지 오기 전에
청산되는 수식을 추가 하고 싶습니다.
그리고
포지션이 있다가 포지션이 모두 청산되면 MaxEntries는 0 이 되는 것인가요?
var: t(0);
input : period(20),period2(20),매수간격(100),매도간격(100) ;
input: 이익변수(560),손절변수(420);
중략~~~~~~~~~
if MarketPosition == 1 Then
{
buy("bb",AtStop,LatestEntryPrice(0)+PriceScale*매수간격);
if MaxEntries == 1 Then
ExitLong("매수1손절",AtStop,EntryPrice-PriceScale*손절변수);
if MaxEntries >= 2 Then
ExitLong("bx",AtStop,AvgEntryPrice);
}
if MarketPosition == -1 Then
{
Sell("ss",AtStop,LatestEntryPrice(0)-PriceScale*매도간격);
if MaxEntries == 1 Then
ExitShort("매도1손절",AtStop,EntryPrice+PriceScale*손절변수 );
if MaxEntries >= 2 Then
ExitShort("sx",AtStop,AvgEntryPrice);
}