예스스탁
예스스탁 답변
2022-03-11 10:41:23
안녕하세요
예스스탁입니다.
1
if Bdate != Bdate[1] Then
Condition1 = False;
entry = True;
위 내용에서 entry = True;는 if문에 포함되는 내용이 아닙니다.
매봉 entry에 true가 저장되게 됩니다.
if문에 포함되는 실행문이 2개 이상이면 반드시 {}로 묶어주셔야 합니다.
if문 아래에 나열해서 쓰는 것만으로 if문에 포함되지 않습니다.
if Bdate != Bdate[1] Then
{
Condition1 = False;
entry = True;
}
2
if NextBarSdate == sDate and (LatestExitName(1) == "손절" or LatestExitName(1) == "본탈" or LatestEntryName(0) == "S1(NEXT)") Then
entry = False;
위와 같이 작성이 되어 있으면 가장최근 청산이 위 3개이면 청산후 다음날 이후에도
entry = False;
가 됩니다.
청산이 발생한 시점에서 청산명 확인하고 한번 false가 되고
날짜가 변경이 되면 true로 초기화가 되게 하셔야 합니다.
if NextBarSdate == sDate and
CurrentContracts < CurrentContracts[1] and
(LatestExitName(1) == "손절" or LatestExitName(1) == "본탈" or LatestEntryName(0) == "S1(NEXT)") Then
entry = False;
3
input :금액1(500000),상한가(36500),손절금액(300000),N(3);
input : 익절(3),익절2(1);
var : cnt(0),sum(0),mav(0),DD(0);
var : day(0),entry(False),AP(0),TT(0);
var : LL(0),RR(0),rate(0);
sum = 0;
For cnt = 0 to N-1
{
sum = sum + DayClose(cnt);
}
mav = (sum/N)*1;
if Bdate != Bdate[1] Then
{
Condition1 = False;
entry = True;
}
if sTime > 120000 and C[0] >= DayClose(1)*1.265 Then
Condition1 = true;
if NextBarSdate == sDate and
CurrentContracts < CurrentContracts[1] and
(LatestExitName(1) == "손절" or LatestExitName(1) == "본탈" or LatestEntryName(0) == "S1(NEXT)") Then
entry = False;
#여기서 부터 매수하기.
if NextBarSdate == sDate and entry == true and (MarketPosition == 0 or (MarketPosition == 1 and sDate == EntryDate)) Then
{
if condition1 == true OR LatestExitName(1) == "4%익절" Then
Buy("상한가매수",AtStop,상한가,Floor(금액1/min(NextBarOpen,상한가)));
if condition1 == true and IsEntryName("상한가매수") == true Then
Buy("BS1(상풀)",AtLimit,상한가*0.955,Floor(금액1/min(NextBarOpen,상한가*0.955)));
if condition1 == true Then
Buy("BS1",AtLimit,Dayclose(1)*1.235,Floor(금액1/min(NextBarOpen,Dayclose(1)*1.235)));
if condition1 == true and LatestEntryName(0) == "BS1" Then
Buy("S1",AtLimit,Dayclose(1)*1.19,Floor(금액1/min(NextBarOpen,Dayclose(1)*1.19)));
if condition1 == true and IsEntryName("BS1") == true and sTime == 150800 Then
Buy("3시10분매수(1-1)",AtMarket,floor(금액1/nextbaropen));
if condition1 == true and IsEntryName("3시10분매수(1-1)") == true and sTime == 151300 Then
Buy("3시15분매수(1-2)",AtMarket,floor(금액1/nextbaropen));
if condition1 == true and IsEntryName("3시10분매수(1-1)") == true and sTime == 151700 Then
Buy("3시19분매수(1-3)",AtMarket,floor(금액1/nextbaropen));
if condition1 == true and MarketPosition == 0 and sTime == 150800 Then
Buy("3시10분매수(2-1)",AtMarket,floor(금액1/nextbaropen));
if condition1 == true and IsEntryName("3시10분매수(2-1)") == true and sTime == 151300 Then
Buy("3시15분매수(2-2)",AtMarket,floor(금액1/nextbaropen));
if condition1 == true and IsEntryName("3시10분매수(2-1)") == true and sTime == 151700 Then
Buy("3시19분매수(2-3)",AtMarket,floor(금액1/nextbaropen));
if MarketPosition == 1 and day >=2 and DayOpen*1.04>=DayHigh Then
Buy("S1(NEXT)",AtLimit,DayHigh*0.92,Floor(금액1/min(NextBarOpen,DayHigh*0.92)));
}
if MarketPosition == 1 and sdate >= EntryDate+1 and L > mav Then
Buy("담날추매",AtLimit,mav,Floor(금액1/min(NextBarOpen,mav)));
#여기서 부터 매도하기.
if MarketPosition == 1 AND (LatestEntryName(0) != "S1" and LatestEntryName(0) != "S1(NEXT)" and LatestEntryName(0) != "BS1(상풀)") Then
{
if LL == 0 then
LL = L;
Else
{
if L < LL then
LL = L;
}
RR = (LL-AVGEntryPrice)/AVGEntryPrice*100;
if RR >= -0.9 Then
Rate = 익절;
if RR >= -2.9 and RR < -0.9 Then
Rate = (익절+RR);
if RR < -2.9 Then
Rate = 0.3;
ExitLong("3%익절",AtLimit,AVGEntryPrice*(1+Rate/100),"",Floor(MaxContracts*0.5));
ExitLong("4%익절",AtLimit,AVGEntryPrice*(1.01+Rate/100));
}
Else
LL = 0;
#----------------------------------------------------------------------------
# 3%, 4% 매도 청산
#----------------------------------------------------------------------------
if MarketPosition == 1 AND (LatestEntryName(0) == "S1" or LatestEntryName(0) == "S1(NEXT)" or LatestEntryName(0) == "BS1(상풀)") Then
{
ExitLong("본탈",AtLimit,AVGEntryPrice*1.005);
}
#----------------------------------------------------------------------------
# 0.3%, 1% 매도 청산
#----------------------------------------------------------------------------
if MarketPosition == 1 Then
if sdate >= EntryDate+1 and sTime == 100000 Then
{
ExitLong("다음날 10시청산");
}
#----------------------------------------------------------------------------
# 다음날 10시 청산
#----------------------------------------------------------------------------
if MarketPosition == 1 Then
ExitLong("손절",AtStop,AvgEntryPrice-손절금액/CurrentContracts);
#----------------------------------------------------------------------------
# 손절
즐거운 하루되세요
> 맴맴잉 님이 쓴 글입니다.
> 제목 : 시스템식 문의 드립니다.
> 위의 그림을 보면 본탈 이후에
다음날 날짜도 지났고 조건도 만족하기 때문에
매수라고 동그라미 쳐진 부분에서 매수가 진행이 되어야 하는데
매수가 진행이 안되었습니다.
아마도 밑에 그림에서 보시다시피 다시 entry에 false가 할당되어서
진행이 안된것 같은데
나름 본탈이후에 당일에만 추가진입을 하지 않기위해서
nextbarsdate == sdate를 넣었는데..
해당식으로는 적용이 안되는것 같습니다.
혹시 몰라서 sdate >= entrydate도 작성해서 시스템적용해봤는데...
적용이 안됩니다. ...ㅜ.ㅜ
혹시 몰라 지금까지 작성된 시스템식 올려봅니다.
--------------------------------------------------------------------------
input :금액1(500000),상한가(36500),손절금액(300000),N(3);
input : 익절(3),익절2(1);
var : cnt(0),sum(0),mav(0),DD(0);
var : day(0),entry(False),AP(0),TT(0);
var : LL(0),RR(0),rate(0);
sum = 0;
For cnt = 0 to N-1
{
sum = sum + DayClose(cnt);
}
mav = (sum/N)*1;
if Bdate != Bdate[1] Then
Condition1 = False;
entry = True;
if sTime > 120000 and C[0] >= DayClose(1)*1.265 Then
Condition1 = true;
if NextBarSdate == sDate and (LatestExitName(1) == "손절" or LatestExitName(1) == "본탈" or LatestEntryName(0) == "S1(NEXT)") Then
entry = False;
#여기서 부터 매수하기.
if NextBarSdate == sDate and entry == true and (MarketPosition == 0 or (MarketPosition == 1 and sDate == EntryDate)) Then
{
if condition1 == true OR LatestExitName(1) == "4%익절" Then
Buy("상한가매수",AtStop,상한가,Floor(금액1/min(NextBarOpen,상한가)));
if condition1 == true and IsEntryName("상한가매수") == true Then
Buy("BS1(상풀)",AtLimit,상한가*0.955,Floor(금액1/min(NextBarOpen,상한가*0.955)));
if condition1 == true Then
Buy("BS1",AtLimit,Dayclose(1)*1.235,Floor(금액1/min(NextBarOpen,Dayclose(1)*1.235)));
if condition1 == true and LatestEntryName(0) == "BS1" Then
Buy("S1",AtLimit,Dayclose(1)*1.19,Floor(금액1/min(NextBarOpen,Dayclose(1)*1.19)));
if condition1 == true and IsEntryName("BS1") == true and sTime == 150800 Then
Buy("3시10분매수(1-1)",AtMarket,floor(금액1/nextbaropen));
if condition1 == true and IsEntryName("3시10분매수(1-1)") == true and sTime == 151300 Then
Buy("3시15분매수(1-2)",AtMarket,floor(금액1/nextbaropen));
if condition1 == true and IsEntryName("3시10분매수(1-1)") == true and sTime == 151700 Then
Buy("3시19분매수(1-3)",AtMarket,floor(금액1/nextbaropen));
if condition1 == true and MarketPosition == 0 and sTime == 150800 Then
Buy("3시10분매수(2-1)",AtMarket,floor(금액1/nextbaropen));
if condition1 == true and IsEntryName("3시10분매수(2-1)") == true and sTime == 151300 Then
Buy("3시15분매수(2-2)",AtMarket,floor(금액1/nextbaropen));
if condition1 == true and IsEntryName("3시10분매수(2-1)") == true and sTime == 151700 Then
Buy("3시19분매수(2-3)",AtMarket,floor(금액1/nextbaropen));
if MarketPosition == 1 and day >=2 and DayOpen*1.04>=DayHigh Then
Buy("S1(NEXT)",AtLimit,DayHigh*0.92,Floor(금액1/min(NextBarOpen,DayHigh*0.92)));
}
if MarketPosition == 1 and sdate >= EntryDate+1 and L > mav Then
Buy("담날추매",AtLimit,mav,Floor(금액1/min(NextBarOpen,mav)));
#여기서 부터 매도하기.
if MarketPosition == 1 AND (LatestEntryName(0) != "S1" and LatestEntryName(0) != "S1(NEXT)" and LatestEntryName(0) != "BS1(상풀)") Then
{
if LL == 0 then
LL = L;
Else
{
if L < LL then
LL = L;
}
RR = (LL-AVGEntryPrice)/AVGEntryPrice*100;
if RR >= -0.9 Then
Rate = 익절;
if RR >= -2.9 and RR < -0.9 Then
Rate = (익절+RR);
if RR < -2.9 Then
Rate = 0.3;
ExitLong("3%익절",AtLimit,AVGEntryPrice*(1+Rate/100),"",Floor(MaxContracts*0.5));
ExitLong("4%익절",AtLimit,AVGEntryPrice*(1.01+Rate/100));
}
Else
LL = 0;
#----------------------------------------------------------------------------
# 3%, 4% 매도 청산
#----------------------------------------------------------------------------
if MarketPosition == 1 AND (LatestEntryName(0) == "S1" or LatestEntryName(0) == "S1(NEXT)" or LatestEntryName(0) == "BS1(상풀)") Then
{
ExitLong("본탈",AtLimit,AVGEntryPrice*1.005);
}
#----------------------------------------------------------------------------
# 0.3%, 1% 매도 청산
#----------------------------------------------------------------------------
if MarketPosition == 1 Then
if sdate >= EntryDate+1 and sTime == 100000 Then
{
ExitLong("다음날 10시청산");
}
#----------------------------------------------------------------------------
# 다음날 10시 청산
#----------------------------------------------------------------------------
if MarketPosition == 1 Then
ExitLong("손절",AtStop,AvgEntryPrice-손절금액/CurrentContracts);
#----------------------------------------------------------------------------
# 손절