예스스탁
예스스탁 답변
2023-02-03 10:27:20
안녕하세요.
예스스탁 입니다.
수식 오류로 보이는 지점은 최저가를 찾는 함수에 L대신 H를 사용하셨고,
SXcond가 True일 때에 진입하도록 설정하셨습니다.
아래 수식 주석에 ★로 작성한 부분이 수정한 내용입니다. 검색하셔서 살펴보시면 좋을 것 같습니다.
즐거운 하루 보내세요.
input : StartTime(090000),EndTime(150000);
input : N(60);
input : 익절틱수(160),손절틱수(80);
var : HH(0),LL(0),PH(0),NL(0),S1(0),D1(0),count1(0),count2(0),Tcond(False),entry(0);
var : BXcond(False),SXcond(False);
var : cnt(0),bloss(0),sloss(0);
HH = highest(H,N);
LL = lowest(L,N); // 저가 L 함수 누락 ★
IF Endtime > starttime Then
SetStopEndofday(Endtime);
Else//
{
if sDate != sDate[1] Then
SetStopEndofday(Endtime);
}
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
Tcond = False;
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
Tcond = true;
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
if Bdate != Bdate[1] Then
{
S1 = TimeToMinutes(stime);
D1 = sdate;
Condition3 = False;
entry = 0;
}
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
bloss = 0;
sloss = 0;
for cnt = 1 to 3
{
if MarketPosition(cnt) == 1 and IsExitName("StopLoss",cnt) == true Then
bloss = bloss+1;
if MarketPosition(cnt) == -1 and IsExitName("StopLoss",cnt) == true Then
sloss = sloss+1;
}
BXcond = MarketPosition == 0 and (bloss == 3 or (bloss < 3 and MarketPosition(1) == 1 and IsExitName("StopLoss",1) == true and C >= ExitPrice(1)));
SXcond = MarketPosition == 0 and (sloss == 3 or (sloss < 3 and MarketPosition(1) == -1 and IsExitName("StopLoss",1) == true and C <= ExitPrice(1)));
#N봉 신저가발생
if L < LL[1] Then
{
Condition1 = true;
#파동카운트 0으로 초기화
count1 = 0;
#양음봉 고가 저장변수 초기화
PH = 0;
}
Else
{
#직전 고점보다 큰 양봉다음음봉 발생
if Condition1 == true and C[1] > O[1] and C < O and
(PH == 0 or (PH > 0 and H[1] > PH)) Then
{
#양봉고가 저장
PH = H[1];
#카운트
count1 = count1+1;
#6번째 매도진입
if count1 == 6 and SXcond == False Then // False인 경우 진입 ★
Sell();
}
}
#N봉 신고가발생
if H > HH[1] Then
{
Condition2 = true;
#파동카운트 0으로 초기화
count2 = 0;
#양음봉 고가 저장변수 초기화
NL = 0;
}
Else
{
#지전고점보다 큰 양봉다음음봉 발생
if Condition2 == true and C[1] < O[1] and C > O and
(NL == 0 or (NL > 0 and L[1] < NL)) Then
{
#음봉저가 저장
NL = L[1];
#카운트
count2 = count2+1;
#6번째 매수진입
if count2 == 6 and BXcond == False Then
Buy();
}
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
if MarketPosition == 0 and
TotalTrades> TotalTrades[1] and
IsExitName("StopProfitTarget",1) == true Then
{
if MarketPosition(1) == 1 Then
Buy("b",AtMarket);
if MarketPosition(1) == -1 Then
Sell("s",AtMarket);
}
> 동백초보 님이 쓴 글입니다.
> 제목 : 수식 검토 부탁합니다.
> 항상 도와주셔서 감사합니다.
아래와 같이 수식을 작성해서 검증을 했는데 매수 매도가 안되는데 왜 그런지 모르겠습니다.
검토 부탁 드립니다.
input : StartTime(080000),EndTime(053000);
input : N(60);
input : 익절틱수(160),손절틱수(80);
var : HH(0),LL(0),PH(0),NL(0),S1(0),D1(0),count1(0),count2(0),Tcond(False),entry(0);
var : BXcond(False),SXcond(False);
var : cnt(0),bloss(0),sloss(0);
HH = highest(H,N);
LL = lowest(N,H);
IF Endtime > starttime Then
SetStopEndofday(Endtime);
Else//
{
if sDate != sDate[1] Then
SetStopEndofday(Endtime);
}
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
Tcond = False;
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
Tcond = true;
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
if Bdate != Bdate[1] Then
{
S1 = TimeToMinutes(stime);
D1 = sdate;
Condition3 = False;
entry = 0;
}
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
bloss = 0;
sloss = 0;
for cnt = 1 to 3
{
if MarketPosition(cnt) == 1 and IsExitName("StopLoss",cnt) == true Then
bloss = bloss+1;
if MarketPosition(cnt) == -1 and IsExitName("StopLoss",cnt) == true Then
sloss = sloss+1;
}
BXcond = MarketPosition == 0 and (bloss == 3 or (bloss < 3 and MarketPosition(1) == 1 and IsExitName("StopLoss",1) == true and C >= ExitPrice(1)));
SXcond = MarketPosition == 0 and (sloss == 3 or (sloss < 3 and MarketPosition(1) == -1 and IsExitName("StopLoss",1) == true and C <= ExitPrice(1)));
#N봉 신저가발생
if L < LL[1] Then
{
Condition1 = true;
#파동카운트 0으로 초기화
count1 = 0;
#양음봉 고가 저장변수 초기화
PH = 0;
}
Else
{
#직전 고점보다 큰 양봉다음음봉 발생
if Condition1 == true and C[1] > O[1] and C < O and
(PH == 0 or (PH > 0 and H[1] > PH)) Then
{
#양봉고가 저장
PH = H[1];
#카운트
count1 = count1+1;
#6번째 매도진입
if count1 == 6 and SXcond == true Then
Sell();
}
}
#N봉 신고가발생
if H > HH[1] Then
{
Condition2 = true;
#파동카운트 0으로 초기화
count2 = 0;
#양음봉 고가 저장변수 초기화
NL = 0;
}
Else
{
#지전고점보다 큰 양봉다음음봉 발생
if Condition2 == true and C[1] < O[1] and C > O and
(NL == 0 or (NL > 0 and L[1] < NL)) Then
{
#음봉저가 저장
NL = L[1];
#카운트
count2 = count2+1;
#6번째 매수진입
if count2 == 6 and BXcond == False Then
Buy();
}
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
if MarketPosition == 0 and
TotalTrades> TotalTrades[1] and
IsExitName("StopProfitTarget",1) == true Then
{
if MarketPosition(1) == 1 Then
Buy("b",AtMarket);
if MarketPosition(1) == -1 Then
Sell("s",AtMarket);
}