예스스탁
예스스탁 답변
2021-07-21 15:52:25
안녕하세요
예스스탁입니다.
var : A1Price(0),A1high(0);
var : A2Price(0),A2high(0);
var : bidx(0);
if MarketPosition == 1 Then
{
#A1진입 발생
#보유수량이 증가하고 최근 발생한 진입명이 A1이면
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "A1" Then
{
#진입가 저장
A1Price = LatestEntryPrice(0);
#진입이후 최고가의 초기값으로 현재봉 고가저장
A1high = H;
}
#새로운 고가가 발생하면 변수의 값을 새로운 고가를 변경
if A1high > 0 and H > A1high Then
A1high = H;
#45% 수익이면 청산
ExitLong("C1",AtLimit,A1Price*1.45,"A1");
#35% 이상 수익이후에 10% 하락하면 청산
if A1high >= A1Price*1.35 Then
ExitLong("C2",AtStop,A1high*0.90,"A1");
#6% 손실시 청산
ExitLong("C3",AtStop,A1Price*0.94,"A1");
#A2진입
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "A2" Then
{
A2Price = LatestEntryPrice(0);
A2high = H;
}
if A2high > 0 and H > A2high Then
A2high = H;
ExitLong("D1",AtLimit,A2Price*1.45,"A2");
if A2high >= A2Price*1.35 Then
ExitLong("D2",AtStop,A2high*0.90,"A2");
ExitLong("D3",AtStop,A2Price*0.94,"A2");
if Bidx == 1540 Then
ExitLong("bx");
}
Else
{
A1Price = 0;
A1high = 0;
A2Price = 0;
A2high = 0;
bidx = 0;
}
즐거운 하루되세요
> 말라 님이 쓴 글입니다.
> 제목 : 안녕하세요 질문드립니다.
> 안녕하세요 먼저 이전의 질문에 대한 답변 너무 감사합니다
제가 여쭈어 봤던건
1. 45프로 이득후 청산 또는
2. 35상승후 10프로 하락시 청산 또는
3. 6프로 하락시 청산 또는
4. 1540봉 경과시 청산
이었습니다.
해서 이걸 써본다면
A1, A2 라는 진입이 2개가 있을경우
1,2,3 조건은 이렇게 작성되는걸로 알고있는데요
여기서 질문드립니다 (질문은 맨 밑에 있습니다)
var : A1Price(0),A1high(0);
var : A2Price(0),A2high(0);
if MarketPosition == 1 Then
{
#A1진입 발생
#보유수량이 증가하고 최근 발생한 진입명이 A1이면
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "A1" Then
{
#진입가 저장
A1Price = LatestEntryPrice(0);
#진입이후 최고가의 초기값으로 현재봉 고가저장
A1high = H;
}
#새로운 고가가 발생하면 변수의 값을 새로운 고가를 변경
if A1high > 0 and H > A1high Then
A1high = H;
#45% 수익이면 청산
ExitLong("C1",AtLimit,A1Price*1.45,"A1");
#35% 이상 수익이후에 10% 하락하면 청산
if A1high >= A1Price*1.35 Then
ExitLong("C2",AtStop,A1high*0.0.9,"A1");
#6% 손실시 청산
ExitLong("C3",AtStop,A1Price*0.94,"A1");
#A2진입
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "A2" Then
{
A2Price = LatestEntryPrice(0);
A2high = H;
}
if A2high > 0 and H > A2high Then
A2high = H;
ExitLong("D1",AtLimit,A2Price*1.45,"A2");
if A2high >= A2Price*1.35 Then
ExitLong("D2",AtStop,A2high*0.90,"A2");
ExitLong("D3",AtStop,A2Price*0.94,"A2");
}
Else
{
A1Price = 0;
A1high = 0;
A2Price = 0;
A2high = 0;
}
--------------------------
질문입니다.
1540봉 이후 청산을 여기 추가하려면
아래 3개의 식을 넣어야하는걸로 알고있는데
어떻게 넣어야하는건지 모르겠어요
대입해주시면 감사하겠습니다.
진입이 2개니까 2번 넣어야하는건지...
진입이 여러개로 늘어날땐 또 어떻게 대입해야하는건지...
진입 개수와 상관없이 하나만 넣으면 되는건지,...너무 어렵네요...
대입좀 부탁드리고 후에 간략한 설명해주심 너무너무 감사하겠습니다.
var : bidx(0);
if Bidx == 1540 Then
ExitLong("bx");
bidx = 0;