커뮤니티

시스템식 문의 드립니다.

프로필 이미지
맴맴잉
2022-03-06 17:26:51
1215
글번호 156958
답변완료

첨부 이미지

시스템 식 작성중에 어려운 부분이 있어 글 작성합니다. 1. if condition1 == true Then Buy("1차매수",AtMarket); 위 식에서 atmarket를 사용했을때에 투자금액을 변수로 넣고 싶습니다. 예를들어 if condition1 == true Then Buy("상한가매수",AtStop,상한가,Floor(금액1/min(NextBarOpen,상한가))); 상한가 매수시스템식에서 floor 이후에 조건을 통해서 금액을 변수로 넣을수가 있었는데.... atmarket이나 onclose 같은 경우 (뒤에 금액이 안붙어도 되는경우) 는 투자금액을 변수로 어떻게 넣어야 할지 잘 모르겠습니다. 2. 나름 식을 작성하였는데.. 생각대로 안되는 부분이 있어 요청드립니다. 2-1 당일에는 매수만 되고 다음날에는 매도가 되어야 하는데 다음날에도 매수가 되는 경우가 있다 .어떻게 해야 하나요?? 2-2 추매이후에는 매도가 안되는데 왜 안될까요 ??? 3. IsEntryName("S1") == true 옆 수식에서 가장 마지막으로 들어간 매수진입명 이 맞는지요?? 밑에 제가 나름 열심히 만들었는데 한번 확인 부탁드리겠습니다. ----------------------------------------------------------------------- input :금액1(500000),상한가(36500),손절금액(300000); 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); if Bdate != Bdate[1] Then Condition1 = False; if sTime > 120000 and C[0] >= DayClose(1)*1.265 Then Condition1 = true; if TotalTrades > TotalTrades[1] Then entry = False; #여기서 부터 매도하기. 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 IsEntryName("BS1") == true and sdate >= EntryDate+1 and day <=1 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); if condition1 == true and IsEntryName("3시10분매수(1-1)") == true and sTime == 151300 Then Buy("3시15분매수(1-2)",AtMarket); if condition1 == true and IsEntryName("3시10분매수(1-1)") == true and sTime == 151700 Then Buy("3시19분매수(1-3)",AtMarket); if condition1 == true and MarketPosition == 0 and sTime == 150800 Then Buy("3시10분매수(2-1)",AtMarket); if condition1 == true and IsEntryName("3시10분매수(2-1)") == true and sTime == 151300 Then Buy("3시15분매수(2-2)",AtMarket); if condition1 == true and IsEntryName("3시10분매수(2-1)") == true and sTime == 151700 Then Buy("3시19분매수(2-3)",AtMarket); 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 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 IsEntryName("S1") == true or IsEntryName("S1(NEXT)") == true or IsEntryName("BS1(상풀)") == true Then { ExitLong("0.3%익절",AtLimit,AVGEntryPrice*1.003,"",Floor(MaxContracts*0.5)); ExitLong("1%익절",AtLimit,AVGEntryPrice*1.1); } Else LL = 0; #---------------------------------------------------------------------------- # 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); #---------------------------------------------------------------------------- # 손절
시스템
답변 2
프로필 이미지

예스스탁 예스스탁 답변

2022-03-07 10:03:38

안녕하세요 예스스탁입니다. 1 onclose와 atmarket은 봉완성시(다음봉시가수신)에 신호가 발생하는 타입니다. onclose는 완성봉 종가, atmarket은 다음봉시가가 신호의 가격입니다. onclose타입이면 C를 atmarket타입은 nextbaropen을 이용하시면 됩니다. if condition1 == true Then Buy("1차매수",onclose,floor(금액1/C)); if condition1 == true Then Buy("1차매수",AtMarket,floor(금액1/nextbaropen)); 2 NextBarSdate == sDate and (MarketPosition == 0 or (MarketPosition == 1 and sDate == EntryDate)) 매수는 첫매수와 같은날만 발생해야 하므로 매수식에 위조건을 추가하시면 됩니다. 또한 atmarket,atstop,atlimit은 if조건 만족하면 다음봉에서 신호가 발생하므로 당일마지막봉에 if조건이 만족하면 다음봉(다음날첫봉)에 신호가 발생할수 있습니다. 이를 막기위해 NextBarSdate == sDate 조건이 필요합니다. 3 IsEntryName("S1")은 첫진입의 명칭입니다. 피라미딩이 아니면 관계없지만 피라미딩 상황에서 가장최근 진입명은 LatestEntryName(0)으로 리턴받아 사용하셔야 합니다. LatestEntryName(0) == "S1" 4 if문 안에 and 와 or를 같이 사용하면 ()로 우선순위를 반드시 지정하셔야 합니다. 현재 청산쪽에 ()없이 단순 나열로 작성된 부분이 있습니다. 5 input :금액1(500000),상한가(36500),손절금액(300000); 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); if Bdate != Bdate[1] Then Condition1 = False; if sTime > 120000 and C[0] >= DayClose(1)*1.265 Then Condition1 = true; if TotalTrades > TotalTrades[1] Then entry = False; #여기서 부터 매도하기. if NextBarSdate == sDate 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 IsEntryName("BS1") == true and sdate >= EntryDate+1 and day <=1 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 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("0.3%익절",AtLimit,AVGEntryPrice*1.003,"",Floor(MaxContracts*0.5)); ExitLong("1%익절",AtLimit,AVGEntryPrice*1.1); } Else LL = 0; #---------------------------------------------------------------------------- # 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); #---------------------------------------------------------------------------- # 손절 즐거운 하루되세요 > 맴맴잉 님이 쓴 글입니다. > 제목 : 시스템식 문의 드립니다. > 시스템 식 작성중에 어려운 부분이 있어 글 작성합니다. 1. if condition1 == true Then Buy("1차매수",AtMarket); 위 식에서 atmarket를 사용했을때에 투자금액을 변수로 넣고 싶습니다. 예를들어 if condition1 == true Then Buy("상한가매수",AtStop,상한가,Floor(금액1/min(NextBarOpen,상한가))); 상한가 매수시스템식에서 floor 이후에 조건을 통해서 금액을 변수로 넣을수가 있었는데.... atmarket이나 onclose 같은 경우 (뒤에 금액이 안붙어도 되는경우) 는 투자금액을 변수로 어떻게 넣어야 할지 잘 모르겠습니다. 2. 나름 식을 작성하였는데.. 생각대로 안되는 부분이 있어 요청드립니다. 2-1 당일에는 매수만 되고 다음날에는 매도가 되어야 하는데 다음날에도 매수가 되는 경우가 있다 .어떻게 해야 하나요?? 2-2 추매이후에는 매도가 안되는데 왜 안될까요 ??? 3. IsEntryName("S1") == true 옆 수식에서 가장 마지막으로 들어간 매수진입명 이 맞는지요?? 밑에 제가 나름 열심히 만들었는데 한번 확인 부탁드리겠습니다. ----------------------------------------------------------------------- input :금액1(500000),상한가(36500),손절금액(300000); 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); if Bdate != Bdate[1] Then Condition1 = False; if sTime > 120000 and C[0] >= DayClose(1)*1.265 Then Condition1 = true; if TotalTrades > TotalTrades[1] Then entry = False; #여기서 부터 매도하기. 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 IsEntryName("BS1") == true and sdate >= EntryDate+1 and day <=1 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); if condition1 == true and IsEntryName("3시10분매수(1-1)") == true and sTime == 151300 Then Buy("3시15분매수(1-2)",AtMarket); if condition1 == true and IsEntryName("3시10분매수(1-1)") == true and sTime == 151700 Then Buy("3시19분매수(1-3)",AtMarket); if condition1 == true and MarketPosition == 0 and sTime == 150800 Then Buy("3시10분매수(2-1)",AtMarket); if condition1 == true and IsEntryName("3시10분매수(2-1)") == true and sTime == 151300 Then Buy("3시15분매수(2-2)",AtMarket); if condition1 == true and IsEntryName("3시10분매수(2-1)") == true and sTime == 151700 Then Buy("3시19분매수(2-3)",AtMarket); 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 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 IsEntryName("S1") == true or IsEntryName("S1(NEXT)") == true or IsEntryName("BS1(상풀)") == true Then { ExitLong("0.3%익절",AtLimit,AVGEntryPrice*1.003,"",Floor(MaxContracts*0.5)); ExitLong("1%익절",AtLimit,AVGEntryPrice*1.1); } Else LL = 0; #---------------------------------------------------------------------------- # 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); #---------------------------------------------------------------------------- # 손절
프로필 이미지

맴맴잉

2022-03-07 10:11:12

감사합니다. > 예스스탁 님이 쓴 글입니다. > 제목 : Re : 시스템식 문의 드립니다. > 안녕하세요 예스스탁입니다. 1 onclose와 atmarket은 봉완성시(다음봉시가수신)에 신호가 발생하는 타입니다. onclose는 완성봉 종가, atmarket은 다음봉시가가 신호의 가격입니다. onclose타입이면 C를 atmarket타입은 nextbaropen을 이용하시면 됩니다. if condition1 == true Then Buy("1차매수",onclose,floor(금액1/C)); if condition1 == true Then Buy("1차매수",AtMarket,floor(금액1/nextbaropen)); 2 NextBarSdate == sDate and (MarketPosition == 0 or (MarketPosition == 1 and sDate == EntryDate)) 매수는 첫매수와 같은날만 발생해야 하므로 매수식에 위조건을 추가하시면 됩니다. 또한 atmarket,atstop,atlimit은 if조건 만족하면 다음봉에서 신호가 발생하므로 당일마지막봉에 if조건이 만족하면 다음봉(다음날첫봉)에 신호가 발생할수 있습니다. 이를 막기위해 NextBarSdate == sDate 조건이 필요합니다. 3 IsEntryName("S1")은 첫진입의 명칭입니다. 피라미딩이 아니면 관계없지만 피라미딩 상황에서 가장최근 진입명은 LatestEntryName(0)으로 리턴받아 사용하셔야 합니다. LatestEntryName(0) == "S1" 4 if문 안에 and 와 or를 같이 사용하면 ()로 우선순위를 반드시 지정하셔야 합니다. 현재 청산쪽에 ()없이 단순 나열로 작성된 부분이 있습니다. 5 input :금액1(500000),상한가(36500),손절금액(300000); 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); if Bdate != Bdate[1] Then Condition1 = False; if sTime > 120000 and C[0] >= DayClose(1)*1.265 Then Condition1 = true; if TotalTrades > TotalTrades[1] Then entry = False; #여기서 부터 매도하기. if NextBarSdate == sDate 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 IsEntryName("BS1") == true and sdate >= EntryDate+1 and day <=1 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 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("0.3%익절",AtLimit,AVGEntryPrice*1.003,"",Floor(MaxContracts*0.5)); ExitLong("1%익절",AtLimit,AVGEntryPrice*1.1); } Else LL = 0; #---------------------------------------------------------------------------- # 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); #---------------------------------------------------------------------------- # 손절 즐거운 하루되세요 > 맴맴잉 님이 쓴 글입니다. > 제목 : 시스템식 문의 드립니다. > 시스템 식 작성중에 어려운 부분이 있어 글 작성합니다. 1. if condition1 == true Then Buy("1차매수",AtMarket); 위 식에서 atmarket를 사용했을때에 투자금액을 변수로 넣고 싶습니다. 예를들어 if condition1 == true Then Buy("상한가매수",AtStop,상한가,Floor(금액1/min(NextBarOpen,상한가))); 상한가 매수시스템식에서 floor 이후에 조건을 통해서 금액을 변수로 넣을수가 있었는데.... atmarket이나 onclose 같은 경우 (뒤에 금액이 안붙어도 되는경우) 는 투자금액을 변수로 어떻게 넣어야 할지 잘 모르겠습니다. 2. 나름 식을 작성하였는데.. 생각대로 안되는 부분이 있어 요청드립니다. 2-1 당일에는 매수만 되고 다음날에는 매도가 되어야 하는데 다음날에도 매수가 되는 경우가 있다 .어떻게 해야 하나요?? 2-2 추매이후에는 매도가 안되는데 왜 안될까요 ??? 3. IsEntryName("S1") == true 옆 수식에서 가장 마지막으로 들어간 매수진입명 이 맞는지요?? 밑에 제가 나름 열심히 만들었는데 한번 확인 부탁드리겠습니다. ----------------------------------------------------------------------- input :금액1(500000),상한가(36500),손절금액(300000); 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); if Bdate != Bdate[1] Then Condition1 = False; if sTime > 120000 and C[0] >= DayClose(1)*1.265 Then Condition1 = true; if TotalTrades > TotalTrades[1] Then entry = False; #여기서 부터 매도하기. 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 IsEntryName("BS1") == true and sdate >= EntryDate+1 and day <=1 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); if condition1 == true and IsEntryName("3시10분매수(1-1)") == true and sTime == 151300 Then Buy("3시15분매수(1-2)",AtMarket); if condition1 == true and IsEntryName("3시10분매수(1-1)") == true and sTime == 151700 Then Buy("3시19분매수(1-3)",AtMarket); if condition1 == true and MarketPosition == 0 and sTime == 150800 Then Buy("3시10분매수(2-1)",AtMarket); if condition1 == true and IsEntryName("3시10분매수(2-1)") == true and sTime == 151300 Then Buy("3시15분매수(2-2)",AtMarket); if condition1 == true and IsEntryName("3시10분매수(2-1)") == true and sTime == 151700 Then Buy("3시19분매수(2-3)",AtMarket); 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 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 IsEntryName("S1") == true or IsEntryName("S1(NEXT)") == true or IsEntryName("BS1(상풀)") == true Then { ExitLong("0.3%익절",AtLimit,AVGEntryPrice*1.003,"",Floor(MaxContracts*0.5)); ExitLong("1%익절",AtLimit,AVGEntryPrice*1.1); } Else LL = 0; #---------------------------------------------------------------------------- # 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); #---------------------------------------------------------------------------- # 손절