예스스탁
예스스탁 답변
2022-07-06 14:45:19
안녕하세요
예스스탁입니다.
if MarketPosition == 1 Then
var1 = LatestEntryPrice(0);
위와 같이 작성하시면 var1에 가장 최근 진입가격이 저장됩니다.
청산완료되어 현재 무포지션이면 직전거래의 매수가격이고
포지션 진행중이면 진행중인 거래의 매수가격입니다.
즉 작성하신 식에서는 가장최근 매수신호의 가격입니다.
차트상 첫진입은 이전에 발생한 매수가 없으므로 0입니다.
그러므로 해당 변수가 0이거나 0보다 크면 종가가 해당변수보다 작다라고 지정하시면 됩니다.
if Bdate != Bdate[1] Then
{
var1 = 0;
}
만약 당일기준으로 해당값을 초기화 한다면
위 내용을 아래수식들에 추가하시면 됩니다.
1
input: n(30), k(5);
var: counting(0);
if Bdate != Bdate[1] or (MarketPosition == 0 and TotalTrades > TotalTrades[1]) Then
counting = 0;
#가장 최근 진입가격
#현재 무포지션이면 직전거래의 매수가격이고
#포지션 진행중이면 진행중인 거래의 매수가격입니다.
if MarketPosition == 1 Then
var1 = LatestEntryPrice(0);
if C <= O-PriceScale*n and (var1 == 0 or (var1 > 0 and C < Var1)) Then
{
counting = counting+1;
if counting >= 3 and counting <= k+2 Then
Buy("b");
if MarketPosition == 1 Then
{
if CurrentContracts > CurrentContracts[1] Then
{
var1 = CurrentContracts-CurrentContracts[1];
Condition1 = true;
}
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "bx1" Then
{
Condition1 = False;
counting = 1;
}
if Condition1 == true Then
ExitLong("bx1",AtLimit,lowest(L,BarsSinceEntry)+PriceScale*n,"",MaxContracts-var1,1);
ExitLong("bx2",AtLimit,lowest(L,BarsSinceEntry)+PriceScale*n*2);
}
}
2
input: n(3), k(5);
var: counting(0);
if Bdate != Bdate[1] or (MarketPosition == 0 and TotalTrades > TotalTrades[1]) Then
counting = 0;
#가장 최근 진입가격
#현재 무포지션이면 직전거래의 매수가격이고
#포지션 진행중이면 진행중인 거래의 매수가격입니다.
if MarketPosition == 1 Then
var1 = LatestEntryPrice(0);
if C <= O*(1-n/100) Then
{
counting = counting+1;
if counting >= 3 and counting <= k+2 Then
Buy("b");
if MarketPosition == 1 Then
{
if CurrentContracts > CurrentContracts[1] Then
{
var1 = CurrentContracts-CurrentContracts[1];
Condition1 = true;
}
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "bx1" Then
{
Condition1 = False;
counting = 1;
}
if Condition1 == true Then
ExitLong("bx1",AtLimit,lowest(L,BarsSinceEntry)*(1+n/100),"",MaxContracts-var1,1);
ExitLong("bx2",AtLimit,lowest(L,BarsSinceEntry)*(1+(n*2)/100));
}
}
즐거운 하루되세요
> JTH 님이 쓴 글입니다.
> 제목 : 문의 드립니다
> 안녕하세요 수정할 부분이 있어서 다시 올립니다~
시가 종가 차이가 n틱 이상일때 1회씩 카운팅하는 부분에서
"마지막 진입 가격보다 아래 있을때만"이란 조건도 만족할때
카운팅하도록 수정할수 있을까요~?
>>>안녕하세요
예스스탁입니다.
1
input: n(30), k(5);
var: counting(0);
if Bdate != Bdate[1] or (MarketPosition == 0 and TotalTrades > TotalTrades[1]) Then
counting = 0;
if C <= O-PriceScale*n Then
{
counting = counting+1;
if counting >= 3 and counting <= k+2 Then
Buy("b");
if MarketPosition == 1 Then
{
if CurrentContracts > CurrentContracts[1] Then
{
var1 = CurrentContracts-CurrentContracts[1];
Condition1 = true;
}
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "bx1" Then
{
Condition1 = False;
counting = 1;
}
if Condition1 == true Then
ExitLong("bx1",AtLimit,lowest(L,BarsSinceEntry)+PriceScale*n,"",MaxContracts-var1,1);
ExitLong("bx2",AtLimit,lowest(L,BarsSinceEntry)+PriceScale*n*2);
}
}
2
input: n(3), k(5);
var: counting(0);
if Bdate != Bdate[1] or (MarketPosition == 0 and TotalTrades > TotalTrades[1]) Then
counting = 0;
if C <= O*(1-n/100) Then
{
counting = counting+1;
if counting >= 3 and counting <= k+2 Then
Buy("b");
if MarketPosition == 1 Then
{
if CurrentContracts > CurrentContracts[1] Then
{
var1 = CurrentContracts-CurrentContracts[1];
Condition1 = true;
}
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "bx1" Then
{
Condition1 = False;
counting = 1;
}
if Condition1 == true Then
ExitLong("bx1",AtLimit,lowest(L,BarsSinceEntry)*(1+n/100),"",MaxContracts-var1,1);
ExitLong("bx2",AtLimit,lowest(L,BarsSinceEntry)*(1+(n*2)/100));
}
}
즐거운 하루되세요
> JTH 님이 쓴 글입니다.
> 제목 : 문의 드립니다
> input: n(30), k(5);
var: counting(0);
분봉 마감에서 시가 - 종가 차이가 n틱을 넘게 하락하면 1회로 카운팅하여,
3회 카운팅된때부터 다음봉 시가에 1차 매수
4회 카운팅된 후 다음봉 시가에 2차 매수
K+2회 카운팅 된 후에 다음봉 시가에 k차 매수
매수가 시작된 이후부터 최저가에서 n틱 상승 가격에 k-1회 매수분 물량 매도
카운팅은 1회로 초기화
최저가에서 2n틱 상승 가격에 나머지 1회 매수분 물량 매도
카운팅은 0회로 초기화
*n틱 대신에 n%로 바꾼 수식도 부탁드립니다