커뮤니티

추가 청산 로직 좀 부탁 드립니다.

프로필 이미지
요타
2021-05-26 20:40:25
1027
글번호 149354
답변완료

첨부 이미지

* 전일 수식중 추가 청산 로직이 생겨 부탁 좀 드립니다. *로직1:진입 계약이 >= 7건 이상이고 건수중 한건 이라도 수익 청산 되면 모두 청산 *로직2:진입 계약이 >= 7건 이상이고 6번째 진입계약이 진입가격 대비 10틱 이상 손실이 한번이라도 발생 하면 기달리다가 최초 진입 가격 대비 10틱 까지 오면 모두 청산. (적당한 가격에서 손실 청산) ## 수식 if MarketPosition == 1 Then { ExitLong("bx",AtLimit,EntryPrice+PriceScale*8); if MaxContracts < 10 Then Buy("b",AtLimit,LatestEntryPrice(0)-PriceScale*7,1); if MaxContracts >= 4 and MaxContracts < 7 Then { ExitLong("bx1",AtLimit,AvgEntryPrice+PriceScale*XX); ExitLong("bx2",AtLimit,EntryPrice); } ## 추가 로직1 : 7건 이상이고 진입 건수중 한계약 이라도 수익 청산 되면 모두 청산 ## 추가 로직2 : 7건 이상이고 6번째 진입계약이 진입가격 대비 10틱 이상 손실이 한번이라도 발생 하면 기달리다가 최초 진입 가격 대비 10틱 까지 오면 모두 청산. } if MarketPosition == -1 Then { ExitShort("sx",AtLimit,EntryPrice-PriceScale*8); if MaxContracts < 10 Then Sell("s",AtLimit,LatestEntryPrice(0)+PriceScale*7,1); if MaxContracts >= 4 and MaxContracts < 7 Then { ExitShort("sx1",AtLimit,AvgEntryPrice-PriceScale*XX); ExitShort("sx2",AtLimit,EntryPrice); } ## 추가 로직1 : 7건 이상이고 진입 건수중 한계약 이라도 수익 청산 되면 모두 청산 ## 추가 로직2 : 7건 이상이고 6번째 진입계약이 진입가격 대비 10틱 이상 손실이 한번이라도 발생 하면 기달리다가 최초 진입 가격 대비 10틱 까지 오면 모두 청산. } ## 청산식 SetStopProfittarget(PriceScale*50,PointStop) ; SetStopLoss(PriceScale*100,PointStop); * 고맙습니다. 많은 도움에 감사 드립니다.
시스템
답변 3
프로필 이미지

예스스탁 예스스탁 답변

2021-05-27 13:29:41

안녕하세요 예스스탁입니다. ## 수식 if MarketPosition == 1 Then { ExitLong("bx",AtLimit,EntryPrice+PriceScale*8); if MaxContracts < 10 Then Buy("b",AtLimit,LatestEntryPrice(0)-PriceScale*7,1); if MaxContracts >= 4 and MaxContracts < 7 Then { ExitLong("bx1",AtLimit,AvgEntryPrice+PriceScale*XX); ExitLong("bx2",AtLimit,EntryPrice); } if MaxEntries == 6 Then Value1 = LatestEntryPrice(0); if MaxEntries >= 6 Then { if L <= value1-PriceScale*10 Then Condition1 = true; } if MaxEntries >= 7 and IsExitName("StopProfitTarget",1) == true Then { ExitLong("bx3"); } if MaxEntries >= 7 and Condition1 == true Then { ExitLong("bx4",AtLimit,EntryPrice-PriceScale*10); } } Else Condition1 = False; if MarketPosition == -1 Then { ExitShort("sx",AtLimit,EntryPrice-PriceScale*8); if MaxContracts < 10 Then Sell("s",AtLimit,LatestEntryPrice(0)+PriceScale*7,1); if MaxContracts >= 4 and MaxContracts < 7 Then { ExitShort("sx1",AtLimit,AvgEntryPrice-PriceScale*XX); ExitShort("sx2",AtLimit,EntryPrice); } if MaxEntries == 6 Then Value2 = LatestEntryPrice(0); if MaxEntries >= 6 Then { if H >= value2+PriceScale*10 Then Condition2 = true; } if MaxEntries >= 7 and IsExitName("StopProfitTarget",1) == true Then { ExitShort("sx3"); } if MaxEntries >= 7 and Condition2 == true Then { ExitShort("sx4",AtLimit,EntryPrice+PriceScale*10); } } Else Condition2 = False; ## 청산식 SetStopProfittarget(PriceScale*50,PointStop) ; SetStopLoss(PriceScale*100,PointStop); 즐거운 하루되세요 > 요타 님이 쓴 글입니다. > 제목 : 추가 청산 로직 좀 부탁 드립니다. > * 전일 수식중 추가 청산 로직이 생겨 부탁 좀 드립니다. *로직1:진입 계약이 >= 7건 이상이고 건수중 한건 이라도 수익 청산 되면 모두 청산 *로직2:진입 계약이 >= 7건 이상이고 6번째 진입계약이 진입가격 대비 10틱 이상 손실이 한번이라도 발생 하면 기달리다가 최초 진입 가격 대비 10틱 까지 오면 모두 청산. (적당한 가격에서 손실 청산) ## 수식 if MarketPosition == 1 Then { ExitLong("bx",AtLimit,EntryPrice+PriceScale*8); if MaxContracts < 10 Then Buy("b",AtLimit,LatestEntryPrice(0)-PriceScale*7,1); if MaxContracts >= 4 and MaxContracts < 7 Then { ExitLong("bx1",AtLimit,AvgEntryPrice+PriceScale*XX); ExitLong("bx2",AtLimit,EntryPrice); } ## 추가 로직1 : 7건 이상이고 진입 건수중 한계약 이라도 수익 청산 되면 모두 청산 ## 추가 로직2 : 7건 이상이고 6번째 진입계약이 진입가격 대비 10틱 이상 손실이 한번이라도 발생 하면 기달리다가 최초 진입 가격 대비 10틱 까지 오면 모두 청산. } if MarketPosition == -1 Then { ExitShort("sx",AtLimit,EntryPrice-PriceScale*8); if MaxContracts < 10 Then Sell("s",AtLimit,LatestEntryPrice(0)+PriceScale*7,1); if MaxContracts >= 4 and MaxContracts < 7 Then { ExitShort("sx1",AtLimit,AvgEntryPrice-PriceScale*XX); ExitShort("sx2",AtLimit,EntryPrice); } ## 추가 로직1 : 7건 이상이고 진입 건수중 한계약 이라도 수익 청산 되면 모두 청산 ## 추가 로직2 : 7건 이상이고 6번째 진입계약이 진입가격 대비 10틱 이상 손실이 한번이라도 발생 하면 기달리다가 최초 진입 가격 대비 10틱 까지 오면 모두 청산. } ## 청산식 SetStopProfittarget(PriceScale*50,PointStop) ; SetStopLoss(PriceScale*100,PointStop); * 고맙습니다. 많은 도움에 감사 드립니다.
프로필 이미지

요타

2021-05-27 14:56:29

input : 시스템적용일(20210424), 시스템시작시간(080000),시스템종료시간(210000); input : ntime(30),P1(20),P2(70),XX(20); var : cnt(0),Xcnt(0),Ecnt(0),Tcond(False) ; var : S1(0),D1(0),TM(0),TF(0); var : sum1(0),mav1(0),sum2(0),mav2(0); Array : CC[100](0); if Bdate != Bdate[1] Then { S1 = TimeToMinutes(stime); D1 = sdate; } if D1 > 0 then { if sdate == D1 Then TM = TimeToMinutes(stime)-S1; Else TM = TimeToMinutes(stime)+1440-S1; TF = TM%ntime; if Bdate != Bdate[1] or (Bdate == Bdate[1] and ntime > 1 and TF < TF[1]) or (Bdate == Bdate[1] and ntime > 1 and TM >= TM[1]+ntime) or (Bdate == Bdate[1] and ntime == 1 and TM > TM[1]) Then { for cnt = 1 to 99 { CC[cnt] = CC[cnt-1][1]; } } CC[0] = C; if CC[P1-1] > 0 then { sum1 = 0; for cnt = 0 to P1-1 { sum1 = sum1+CC[cnt]; } mav1 = sum1/P1; } if CC[P2-1] > 0 then { sum2 = 0; for cnt = 0 to P2-1 { sum2 = sum2+CC[cnt]; } mav2 = sum2/P2; } } if 시스템종료시간 > 시스템시작시간 then SetStopEndofday(시스템종료시간); Else { if sDate != sDate[1] Then SetStopEndofday(시스템종료시간); } if (sDate != sDate[1] and sTime >= 시스템종료시간) or (sDate == sDate[1] and sTime >= 시스템종료시간 and sTime[1] < 시스템종료시간) then { Tcond = False; } if (sDate != sDate[1] and sTime >= 시스템시작시간) or (sDate == sDate[1] and sTime >= 시스템시작시간 and sTime[1] < 시스템시작시간) then { Tcond = true; Ecnt = 0; Xcnt = 0 ; if 시스템종료시간 < 시스템시작시간 then SetStopEndofday(0); } if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or (MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then Ecnt = Ecnt + 1; if sdate >= 시스템적용일 and Tcond == true Then { ## 매매식 입력 If stime < 080300 and mav1 > mav2 and mav1 > 0 and mav2 > 0 Then Buy("SS1",OnClose,DEF,2); If stime < 080300 and mav1 < mav2 and mav1 > 0 and mav2 > 0 Then Sell("DD1",OnClose,DEF,2); } ## 추가 매수식 ## 수식 if MarketPosition == 1 Then { ExitLong("bx",AtLimit,EntryPrice+PriceScale*8); if MaxContracts < 10 Then Buy("b",AtLimit,LatestEntryPrice(0)-PriceScale*7,1); if MaxContracts >= 4 and MaxContracts < 7 Then { ExitLong("bx1",AtLimit,AvgEntryPrice+PriceScale*XX); ExitLong("bx2",AtLimit,EntryPrice); } if MaxEntries == 6 Then Value1 = LatestEntryPrice(0); if MaxEntries >= 6 Then { if L <= value1-PriceScale*10 Then Condition1 = true; } if MaxEntries >= 7 and IsExitName("StopProfitTarget",1) == true Then { ExitLong("bx3"); } if MaxEntries >= 7 and Condition1 == true Then { ExitLong("bx4",AtLimit,EntryPrice-PriceScale*10); } } Else Condition1 = False; if MarketPosition == -1 Then { ExitShort("sx",AtLimit,EntryPrice-PriceScale*8); if MaxContracts < 10 Then Sell("s",AtLimit,LatestEntryPrice(0)+PriceScale*7,1); if MaxContracts >= 4 and MaxContracts < 7 Then { ExitShort("sx1",AtLimit,AvgEntryPrice-PriceScale*XX); ExitShort("sx2",AtLimit,EntryPrice); } if MaxEntries == 6 Then Value2 = LatestEntryPrice(0); if MaxEntries >= 6 Then { if H >= value2+PriceScale*10 Then Condition2 = true; } if MaxEntries >= 7 and IsExitName("StopProfitTarget",1) == true Then { ExitShort("sx3"); } if MaxEntries >= 7 and Condition2 == true Then { ExitShort("sx4",AtLimit,EntryPrice+PriceScale*10); } } Else Condition2 = False; /* if MarketPosition == 1 Then { ExitLong("bx",AtLimit,EntryPrice+PriceScale*xx); if MaxContracts < 10 Then Buy("b",AtLimit,LatestEntryPrice(0)-PriceScale*10,1); if MaxContracts >= 4 Then ExitLong("bx1",AtLimit,AvgEntryPrice+PriceScale*XX); } if MarketPosition == -1 Then { ExitShort("sx",AtLimit,EntryPrice-PriceScale*xx); if MaxContracts < 10 Then Sell("s",AtLimit,LatestEntryPrice(0)+PriceScale*10,1); if MaxContracts >= 2 Then ExitShort("sx1",AtLimit,AvgEntryPrice-PriceScale*XX);*/ ///} ## 청산식 SetStopProfittarget(PriceScale*40,PointStop) ; SetStopLoss(PriceScale*80,PointStop); > 예스스탁 님이 쓴 글입니다. > 제목 : Re : 추가 청산 로직 좀 부탁 드립니다. > 안녕하세요 예스스탁입니다. ## 수식 if MarketPosition == 1 Then { ExitLong("bx",AtLimit,EntryPrice+PriceScale*8); if MaxContracts < 10 Then Buy("b",AtLimit,LatestEntryPrice(0)-PriceScale*7,1); if MaxContracts >= 4 and MaxContracts < 7 Then { ExitLong("bx1",AtLimit,AvgEntryPrice+PriceScale*XX); ExitLong("bx2",AtLimit,EntryPrice); } if MaxEntries == 6 Then Value1 = LatestEntryPrice(0); if MaxEntries >= 6 Then { if L <= value1-PriceScale*10 Then Condition1 = true; } if MaxEntries >= 7 and IsExitName("StopProfitTarget",1) == true Then { ExitLong("bx3"); } if MaxEntries >= 7 and Condition1 == true Then { ExitLong("bx4",AtLimit,EntryPrice-PriceScale*10); } } Else Condition1 = False; if MarketPosition == -1 Then { ExitShort("sx",AtLimit,EntryPrice-PriceScale*8); if MaxContracts < 10 Then Sell("s",AtLimit,LatestEntryPrice(0)+PriceScale*7,1); if MaxContracts >= 4 and MaxContracts < 7 Then { ExitShort("sx1",AtLimit,AvgEntryPrice-PriceScale*XX); ExitShort("sx2",AtLimit,EntryPrice); } if MaxEntries == 6 Then Value2 = LatestEntryPrice(0); if MaxEntries >= 6 Then { if H >= value2+PriceScale*10 Then Condition2 = true; } if MaxEntries >= 7 and IsExitName("StopProfitTarget",1) == true Then { ExitShort("sx3"); } if MaxEntries >= 7 and Condition2 == true Then { ExitShort("sx4",AtLimit,EntryPrice+PriceScale*10); } } Else Condition2 = False; ## 청산식 SetStopProfittarget(PriceScale*50,PointStop) ; SetStopLoss(PriceScale*100,PointStop); 즐거운 하루되세요 > 요타 님이 쓴 글입니다. > 제목 : 추가 청산 로직 좀 부탁 드립니다. > * 전일 수식중 추가 청산 로직이 생겨 부탁 좀 드립니다. *로직1:진입 계약이 >= 7건 이상이고 건수중 한건 이라도 수익 청산 되면 모두 청산 *로직2:진입 계약이 >= 7건 이상이고 6번째 진입계약이 진입가격 대비 10틱 이상 손실이 한번이라도 발생 하면 기달리다가 최초 진입 가격 대비 10틱 까지 오면 모두 청산. (적당한 가격에서 손실 청산) ## 수식 if MarketPosition == 1 Then { ExitLong("bx",AtLimit,EntryPrice+PriceScale*8); if MaxContracts < 10 Then Buy("b",AtLimit,LatestEntryPrice(0)-PriceScale*7,1); if MaxContracts >= 4 and MaxContracts < 7 Then { ExitLong("bx1",AtLimit,AvgEntryPrice+PriceScale*XX); ExitLong("bx2",AtLimit,EntryPrice); } ## 추가 로직1 : 7건 이상이고 진입 건수중 한계약 이라도 수익 청산 되면 모두 청산 ## 추가 로직2 : 7건 이상이고 6번째 진입계약이 진입가격 대비 10틱 이상 손실이 한번이라도 발생 하면 기달리다가 최초 진입 가격 대비 10틱 까지 오면 모두 청산. } if MarketPosition == -1 Then { ExitShort("sx",AtLimit,EntryPrice-PriceScale*8); if MaxContracts < 10 Then Sell("s",AtLimit,LatestEntryPrice(0)+PriceScale*7,1); if MaxContracts >= 4 and MaxContracts < 7 Then { ExitShort("sx1",AtLimit,AvgEntryPrice-PriceScale*XX); ExitShort("sx2",AtLimit,EntryPrice); } ## 추가 로직1 : 7건 이상이고 진입 건수중 한계약 이라도 수익 청산 되면 모두 청산 ## 추가 로직2 : 7건 이상이고 6번째 진입계약이 진입가격 대비 10틱 이상 손실이 한번이라도 발생 하면 기달리다가 최초 진입 가격 대비 10틱 까지 오면 모두 청산. } ## 청산식 SetStopProfittarget(PriceScale*50,PointStop) ; SetStopLoss(PriceScale*100,PointStop); * 고맙습니다. 많은 도움에 감사 드립니다.
프로필 이미지

예스스탁 예스스탁 답변

2021-05-27 15:10:58

안녕하세요 예스스탁입니다. input : 시스템적용일(20210424), 시스템시작시간(080000),시스템종료시간(210000); input : 익절틱수(40),손절틱수(20); input : ntime(30),P1(20),P2(70),XX(20); var : cnt(0),Xcnt(0),Ecnt(0),Tcond(False) ; var : S1(0),D1(0),TM(0),TF(0); var : sum1(0),mav1(0),sum2(0),mav2(0); Array : CC[100](0); if Bdate != Bdate[1] Then { S1 = TimeToMinutes(stime); D1 = sdate; } if D1 > 0 then { if sdate == D1 Then TM = TimeToMinutes(stime)-S1; Else TM = TimeToMinutes(stime)+1440-S1; TF = TM%ntime; if Bdate != Bdate[1] or (Bdate == Bdate[1] and ntime > 1 and TF < TF[1]) or (Bdate == Bdate[1] and ntime > 1 and TM >= TM[1]+ntime) or (Bdate == Bdate[1] and ntime == 1 and TM > TM[1]) Then { for cnt = 1 to 99 { CC[cnt] = CC[cnt-1][1]; } } CC[0] = C; if CC[P1-1] > 0 then { sum1 = 0; for cnt = 0 to P1-1 { sum1 = sum1+CC[cnt]; } mav1 = sum1/P1; } if CC[P2-1] > 0 then { sum2 = 0; for cnt = 0 to P2-1 { sum2 = sum2+CC[cnt]; } mav2 = sum2/P2; } } if 시스템종료시간 > 시스템시작시간 then SetStopEndofday(시스템종료시간); Else { if sDate != sDate[1] Then SetStopEndofday(시스템종료시간); } if (sDate != sDate[1] and sTime >= 시스템종료시간) or (sDate == sDate[1] and sTime >= 시스템종료시간 and sTime[1] < 시스템종료시간) then { Tcond = False; } if (sDate != sDate[1] and sTime >= 시스템시작시간) or (sDate == sDate[1] and sTime >= 시스템시작시간 and sTime[1] < 시스템시작시간) then { Tcond = true; Ecnt = 0; Xcnt = 0 ; if 시스템종료시간 < 시스템시작시간 then SetStopEndofday(0); } if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or (MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then Ecnt = Ecnt + 1; if sdate >= 시스템적용일 and Tcond == true Then { ## 매매식 입력 If stime < 080300 and mav1 > mav2 and mav1 > 0 and mav2 > 0 Then Buy("SS1",OnClose,DEF,2); If stime < 080300 and mav1 < mav2 and mav1 > 0 and mav2 > 0 Then Sell("DD1",OnClose,DEF,2); } ## 추가 매수식 ## 수식 if MarketPosition == 1 Then { ExitLong("bx",AtLimit,EntryPrice+PriceScale*8); if MaxContracts < 10 Then Buy("b",AtLimit,LatestEntryPrice(0)-PriceScale*7,1); if MaxContracts >= 4 and MaxContracts < 7 Then { ExitLong("bx1",AtLimit,AvgEntryPrice+PriceScale*XX); ExitLong("bx2",AtLimit,EntryPrice); } if MaxEntries == 6 Then Value1 = LatestEntryPrice(0); if MaxEntries >= 6 Then { if L <= value1-PriceScale*10 Then Condition1 = true; } if MaxEntries >= 7 Then { ExitLong("bx3",AtLimit,LatestEntryPrice(0)+PriceScale*익절틱수); } if MaxEntries >= 7 and Condition1 == true Then { ExitLong("bx4",AtLimit,EntryPrice-PriceScale*10); } } Else Condition1 = False; if MarketPosition == -1 Then { ExitShort("sx",AtLimit,EntryPrice-PriceScale*8); if MaxContracts < 10 Then Sell("s",AtLimit,LatestEntryPrice(0)+PriceScale*7,1); if MaxContracts >= 4 and MaxContracts < 7 Then { ExitShort("sx1",AtLimit,AvgEntryPrice-PriceScale*XX); ExitShort("sx2",AtLimit,EntryPrice); } if MaxEntries == 6 Then Value2 = LatestEntryPrice(0); if MaxEntries >= 6 Then { if H >= value2+PriceScale*10 Then Condition2 = true; } if MaxEntries >= 7 Then { ExitShort("sx3",AtLimit,LatestEntryPrice(0)-PriceScale*익절틱수); } if MaxEntries >= 7 and Condition2 == true Then { ExitShort("sx4",AtLimit,EntryPrice+PriceScale*10); } } Else Condition2 = False; /* if MarketPosition == 1 Then { ExitLong("bx",AtLimit,EntryPrice+PriceScale*xx); if MaxContracts < 10 Then Buy("b",AtLimit,LatestEntryPrice(0)-PriceScale*10,1); if MaxContracts >= 4 Then ExitLong("bx1",AtLimit,AvgEntryPrice+PriceScale*XX); } if MarketPosition == -1 Then { ExitShort("sx",AtLimit,EntryPrice-PriceScale*xx); if MaxContracts < 10 Then Sell("s",AtLimit,LatestEntryPrice(0)+PriceScale*10,1); if MaxContracts >= 2 Then ExitShort("sx1",AtLimit,AvgEntryPrice-PriceScale*XX);*/ ///} ## 청산식 SetStopProfittarget(PriceScale*익절틱수,PointStop) ; SetStopLoss(PriceScale*손절틱수,PointStop); 즐거운 하루되세요 > 요타 님이 쓴 글입니다. > 제목 : Re : Re : 추가 청산 로직 좀 부탁 드립니다. > input : 시스템적용일(20210424), 시스템시작시간(080000),시스템종료시간(210000); input : ntime(30),P1(20),P2(70),XX(20); var : cnt(0),Xcnt(0),Ecnt(0),Tcond(False) ; var : S1(0),D1(0),TM(0),TF(0); var : sum1(0),mav1(0),sum2(0),mav2(0); Array : CC[100](0); if Bdate != Bdate[1] Then { S1 = TimeToMinutes(stime); D1 = sdate; } if D1 > 0 then { if sdate == D1 Then TM = TimeToMinutes(stime)-S1; Else TM = TimeToMinutes(stime)+1440-S1; TF = TM%ntime; if Bdate != Bdate[1] or (Bdate == Bdate[1] and ntime > 1 and TF < TF[1]) or (Bdate == Bdate[1] and ntime > 1 and TM >= TM[1]+ntime) or (Bdate == Bdate[1] and ntime == 1 and TM > TM[1]) Then { for cnt = 1 to 99 { CC[cnt] = CC[cnt-1][1]; } } CC[0] = C; if CC[P1-1] > 0 then { sum1 = 0; for cnt = 0 to P1-1 { sum1 = sum1+CC[cnt]; } mav1 = sum1/P1; } if CC[P2-1] > 0 then { sum2 = 0; for cnt = 0 to P2-1 { sum2 = sum2+CC[cnt]; } mav2 = sum2/P2; } } if 시스템종료시간 > 시스템시작시간 then SetStopEndofday(시스템종료시간); Else { if sDate != sDate[1] Then SetStopEndofday(시스템종료시간); } if (sDate != sDate[1] and sTime >= 시스템종료시간) or (sDate == sDate[1] and sTime >= 시스템종료시간 and sTime[1] < 시스템종료시간) then { Tcond = False; } if (sDate != sDate[1] and sTime >= 시스템시작시간) or (sDate == sDate[1] and sTime >= 시스템시작시간 and sTime[1] < 시스템시작시간) then { Tcond = true; Ecnt = 0; Xcnt = 0 ; if 시스템종료시간 < 시스템시작시간 then SetStopEndofday(0); } if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or (MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then Ecnt = Ecnt + 1; if sdate >= 시스템적용일 and Tcond == true Then { ## 매매식 입력 If stime < 080300 and mav1 > mav2 and mav1 > 0 and mav2 > 0 Then Buy("SS1",OnClose,DEF,2); If stime < 080300 and mav1 < mav2 and mav1 > 0 and mav2 > 0 Then Sell("DD1",OnClose,DEF,2); } ## 추가 매수식 ## 수식 if MarketPosition == 1 Then { ExitLong("bx",AtLimit,EntryPrice+PriceScale*8); if MaxContracts < 10 Then Buy("b",AtLimit,LatestEntryPrice(0)-PriceScale*7,1); if MaxContracts >= 4 and MaxContracts < 7 Then { ExitLong("bx1",AtLimit,AvgEntryPrice+PriceScale*XX); ExitLong("bx2",AtLimit,EntryPrice); } if MaxEntries == 6 Then Value1 = LatestEntryPrice(0); if MaxEntries >= 6 Then { if L <= value1-PriceScale*10 Then Condition1 = true; } if MaxEntries >= 7 and IsExitName("StopProfitTarget",1) == true Then { ExitLong("bx3"); } if MaxEntries >= 7 and Condition1 == true Then { ExitLong("bx4",AtLimit,EntryPrice-PriceScale*10); } } Else Condition1 = False; if MarketPosition == -1 Then { ExitShort("sx",AtLimit,EntryPrice-PriceScale*8); if MaxContracts < 10 Then Sell("s",AtLimit,LatestEntryPrice(0)+PriceScale*7,1); if MaxContracts >= 4 and MaxContracts < 7 Then { ExitShort("sx1",AtLimit,AvgEntryPrice-PriceScale*XX); ExitShort("sx2",AtLimit,EntryPrice); } if MaxEntries == 6 Then Value2 = LatestEntryPrice(0); if MaxEntries >= 6 Then { if H >= value2+PriceScale*10 Then Condition2 = true; } if MaxEntries >= 7 and IsExitName("StopProfitTarget",1) == true Then { ExitShort("sx3"); } if MaxEntries >= 7 and Condition2 == true Then { ExitShort("sx4",AtLimit,EntryPrice+PriceScale*10); } } Else Condition2 = False; /* if MarketPosition == 1 Then { ExitLong("bx",AtLimit,EntryPrice+PriceScale*xx); if MaxContracts < 10 Then Buy("b",AtLimit,LatestEntryPrice(0)-PriceScale*10,1); if MaxContracts >= 4 Then ExitLong("bx1",AtLimit,AvgEntryPrice+PriceScale*XX); } if MarketPosition == -1 Then { ExitShort("sx",AtLimit,EntryPrice-PriceScale*xx); if MaxContracts < 10 Then Sell("s",AtLimit,LatestEntryPrice(0)+PriceScale*10,1); if MaxContracts >= 2 Then ExitShort("sx1",AtLimit,AvgEntryPrice-PriceScale*XX);*/ ///} ## 청산식 SetStopProfittarget(PriceScale*40,PointStop) ; SetStopLoss(PriceScale*80,PointStop); > 예스스탁 님이 쓴 글입니다. > 제목 : Re : 추가 청산 로직 좀 부탁 드립니다. > 안녕하세요 예스스탁입니다. ## 수식 if MarketPosition == 1 Then { ExitLong("bx",AtLimit,EntryPrice+PriceScale*8); if MaxContracts < 10 Then Buy("b",AtLimit,LatestEntryPrice(0)-PriceScale*7,1); if MaxContracts >= 4 and MaxContracts < 7 Then { ExitLong("bx1",AtLimit,AvgEntryPrice+PriceScale*XX); ExitLong("bx2",AtLimit,EntryPrice); } if MaxEntries == 6 Then Value1 = LatestEntryPrice(0); if MaxEntries >= 6 Then { if L <= value1-PriceScale*10 Then Condition1 = true; } if MaxEntries >= 7 and IsExitName("StopProfitTarget",1) == true Then { ExitLong("bx3"); } if MaxEntries >= 7 and Condition1 == true Then { ExitLong("bx4",AtLimit,EntryPrice-PriceScale*10); } } Else Condition1 = False; if MarketPosition == -1 Then { ExitShort("sx",AtLimit,EntryPrice-PriceScale*8); if MaxContracts < 10 Then Sell("s",AtLimit,LatestEntryPrice(0)+PriceScale*7,1); if MaxContracts >= 4 and MaxContracts < 7 Then { ExitShort("sx1",AtLimit,AvgEntryPrice-PriceScale*XX); ExitShort("sx2",AtLimit,EntryPrice); } if MaxEntries == 6 Then Value2 = LatestEntryPrice(0); if MaxEntries >= 6 Then { if H >= value2+PriceScale*10 Then Condition2 = true; } if MaxEntries >= 7 and IsExitName("StopProfitTarget",1) == true Then { ExitShort("sx3"); } if MaxEntries >= 7 and Condition2 == true Then { ExitShort("sx4",AtLimit,EntryPrice+PriceScale*10); } } Else Condition2 = False; ## 청산식 SetStopProfittarget(PriceScale*50,PointStop) ; SetStopLoss(PriceScale*100,PointStop); 즐거운 하루되세요 > 요타 님이 쓴 글입니다. > 제목 : 추가 청산 로직 좀 부탁 드립니다. > * 전일 수식중 추가 청산 로직이 생겨 부탁 좀 드립니다. *로직1:진입 계약이 >= 7건 이상이고 건수중 한건 이라도 수익 청산 되면 모두 청산 *로직2:진입 계약이 >= 7건 이상이고 6번째 진입계약이 진입가격 대비 10틱 이상 손실이 한번이라도 발생 하면 기달리다가 최초 진입 가격 대비 10틱 까지 오면 모두 청산. (적당한 가격에서 손실 청산) ## 수식 if MarketPosition == 1 Then { ExitLong("bx",AtLimit,EntryPrice+PriceScale*8); if MaxContracts < 10 Then Buy("b",AtLimit,LatestEntryPrice(0)-PriceScale*7,1); if MaxContracts >= 4 and MaxContracts < 7 Then { ExitLong("bx1",AtLimit,AvgEntryPrice+PriceScale*XX); ExitLong("bx2",AtLimit,EntryPrice); } ## 추가 로직1 : 7건 이상이고 진입 건수중 한계약 이라도 수익 청산 되면 모두 청산 ## 추가 로직2 : 7건 이상이고 6번째 진입계약이 진입가격 대비 10틱 이상 손실이 한번이라도 발생 하면 기달리다가 최초 진입 가격 대비 10틱 까지 오면 모두 청산. } if MarketPosition == -1 Then { ExitShort("sx",AtLimit,EntryPrice-PriceScale*8); if MaxContracts < 10 Then Sell("s",AtLimit,LatestEntryPrice(0)+PriceScale*7,1); if MaxContracts >= 4 and MaxContracts < 7 Then { ExitShort("sx1",AtLimit,AvgEntryPrice-PriceScale*XX); ExitShort("sx2",AtLimit,EntryPrice); } ## 추가 로직1 : 7건 이상이고 진입 건수중 한계약 이라도 수익 청산 되면 모두 청산 ## 추가 로직2 : 7건 이상이고 6번째 진입계약이 진입가격 대비 10틱 이상 손실이 한번이라도 발생 하면 기달리다가 최초 진입 가격 대비 10틱 까지 오면 모두 청산. } ## 청산식 SetStopProfittarget(PriceScale*50,PointStop) ; SetStopLoss(PriceScale*100,PointStop); * 고맙습니다. 많은 도움에 감사 드립니다.