커뮤니티

수식 부탁드립니다.

프로필 이미지
제이디1
2022-07-15 11:24:05
1175
글번호 160759
답변완료
더운데 고생 많으십니다. 1.아래 수식에 당일손절(800) 추가 해 주세요. 2.전일 마지막신호가 매수였다면, 당일 시작과 동시에 매수진입이 될수 있게 해 주세요. 3.같은 수식을 이베스트하고 nh선물에 적용하면 거래선이 틀리던데, 왜 그럴까요? ================================================================================ Input:전환비율(5); input : StartTime(070000),EndTime(060000); Input :익절(500),손절(200),당일수익(900); Var : N1(0),dayPl(0),Tcond(false),Xcond(false); Var : j(0),jj(0),HH(0),LL(0),hiBar(0),loBar(0),최종꼭지점(""),처리구분(""); var : TL1(0),Text1(0),ADXV1(0),tl2(0),tl3(0),tx2(0),tx3(0),t(0); Array:고[10,4](0),저[10,4](0); if V == highest(V,120) Then var5 = (C+H+L)/3; #120거래선# if V == highest(V,360) Then var12 = (C+H+L)/3; #360거래선# HH = H; LL = L; If Index == 0 Then { 고[1,1] = HH; 고[1,2] = 0; 고[1,3] = sDate; 고[1,4] = sTime; 저[1,1] = LL; 저[1,2] = 0; 저[1,3] = sDate; 저[1,4] = sTime; } If Index > 0 Then { hiBar = hiBar + 1; loBar = loBar + 1; } If HH[hiBar] < HH Then hiBar = 0; If LL[loBar] > LL Then loBar = 0; Condition1 = 저[1,1] * (1 + (전환비율/100)) < HH and hiBar == 0; Condition2 = 고[1,1] * (1 - (전환비율/100)) > LL and loBar == 0; 처리구분 = ""; If Condition1 and Condition2 Then // 고점과 저점 조건 동시 만족 { If 최종꼭지점 == "저점" Then { If 저[1,1] > LL Then 처리구분 = "저점처리"; Else 처리구분 = "고점처리"; } Else If 최종꼭지점 == "고점" Then { If 고[1,1] < HH Then 처리구분 = "고점처리"; Else 처리구분 = "저점처리"; } } Else If Condition1 Then 처리구분 = "고점처리"; Else If Condition2 Then 처리구분 = "저점처리"; If 처리구분 == "고점처리" Then { T = 1; If 최종꼭지점 == "저점" Then { TL_SetEnd(TL2,저[1,3],저[1,4],고[1,1]* (1 - (전환비율/100)) ); Text_SetLocation(TX2,저[1,3],저[1,4],고[1,1]* (1 - (전환비율/100)) ); For j = 10 DownTo 2 { For jj = 1 To 4 { 고[j,jj] = 고[j-1,jj]; } } 고[1,1] = HH[hiBar]; 고[1,2] = Index - hiBar; 고[1,3] = sDate[hiBar]; 고[1,4] = sTime[hiBar]; hiBar = -1; loBar = -1; TL1 = TL_New(저[1,3],저[1,4],저[1,1],고[1,3],고[1,4],고[1,1]); TL_SetSize(TL1,1); TL_SetColor(TL1,RED); TL2 = TL_New(고[1,3],고[1,4],고[1,1]*(1-(전환비율/100)) ,NextBarSdate,NextBarStime,고[1,1]*(1-(전환비율/100)) ); TL_SetColor(TL2,Cyan); TL_SetStyle(TL2,3); Tx2 = Text_New(NextBarSdate,NextBarStime,고[1,1]*(1-(전환비율/100)),NumToStr(고[1,1]*(1-(전환비율/100)),2)); Text_SetColor(Tx2,Cyan); } Else If 고[1,1] < HH[hiBar] Then // 1번 고점보다 높은 고가 출현 { 고[1,1] = HH[hiBar]; 고[1,2] = Index - hiBar; 고[1,3] = sDate[hiBar]; 고[1,4] = sTime[hiBar]; hiBar = -1; loBar = -1; TL_SetEnd(TL1,고[1,3],고[1,4],고[1,1]); TL_SetBegin(TL2,고[1,3],고[1,4],고[1,1]* (1-(전환비율/100)) ); Text_SetString(TX2,NumToStr(고[1,1]*(1-(전환비율/100)),2)); } 최종꼭지점 = "고점"; } If 처리구분 == "저점처리" Then { t = -1; If 최종꼭지점 == "고점" Then { TL_SetEnd(TL3,고[1,3],고[1,4],저[1,1]* (1 + (전환비율/100)) ); Text_SetLocation(TX3,고[1,3],고[1,4],저[1,1]* (1 + (전환비율/100)) ); For j = 10 DownTo 2 { For jj = 1 To 4 { 저[j,jj] = 저[j-1,jj]; } } 저[1,1] = LL[loBar]; 저[1,2] = Index - loBar; 저[1,3] = sDate[loBar]; 저[1,4] = sTime[loBar]; hiBar = -1; loBar = -1; TL1 = TL_New(고[1,3],고[1,4],고[1,1],저[1,3],저[1,4],저[1,1]); TL_SetSize(TL1,1); TL_SetColor(TL1,BLUE); TL3 = TL_New(저[1,3],저[1,4],저[1,1]* (1 + (전환비율/100)) ,NextBarSdate,NextBarStime,저[1,1]* (1 + (전환비율/100)) ); TL_SetColor(TL3,Magenta); TL_SetStyle(TL3,3); TX3 = Text_New(NextBarSdate,NextBarStime,저[1,1]*(1+(전환비율/100)),NumToStr(저[1,1]*(1+(전환비율/100)),2)); Text_SetColor(TX3,Magenta); } Else If 저[1,1] > LL[loBar] Then { 저[1,1] = LL[loBar]; 저[1,2] = Index - loBar; 저[1,3] = sDate[loBar]; 저[1,4] = sTime[loBar]; hiBar = -1; loBar = -1; TL_SetEnd(TL1,저[1,3],저[1,4],저[1,1]); TL_SetBegin(TL3,저[1,3],저[1,4],저[1,1]* (1 + (전환비율/100)) ); Text_SetString(TX3,NumToStr(저[1,1]*(1+(전환비율/100)),2)); } 최종꼭지점 = "저점"; } TL_SetEnd(TL2,NextBarSdate,NextBarStime,고[1,1]* (1 - (전환비율/100)) ); Text_SetLocation(TX2,NextBarSdate,NextBarStime,고[1,1]* (1 - (전환비율/100)) ); TL_SetEnd(TL3,NextBarSdate,NextBarStime,저[1,1]* (1 + (전환비율/100)) ); Text_SetLocation(TX3,NextBarSdate,NextBarStime,저[1,1]* (1 + (전환비율/100)) ); 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 Bdate != Bdate[1] Then { Tcond = true; Xcond = false; N1 = NetProfit; IF Endtime <= starttime Then { SetStopEndofday(0); } } daypl = NetProfit-N1; if TotalTrades > TotalTrades[1] then { if daypl >= 당일수익 Then Xcond = true; if (IsExitName("dbp",1) == true or IsExitName("dsp",1) == true) then Xcond = true; } if Tcond == true and Xcond == false then { if MarketPosition >= 0 and T == 1 and L > 고[1,1]* (1 - (전환비율/100)) and Var5<var12 Then Sell("s",AtStop,고[1,1]* (1 - (전환비율/100))); if MarketPosition <= 0 and T == -1 and H < 저[1,1]* (1 + (전환비율/100)) and Var5>var12 Then Buy("b",AtStop,저[1,1]* (1 + (전환비율/100))); } if MarketPosition == 1 then { ExitLong("dbp",atlimit,EntryPrice+((당일수익-daypl)/CurrentContracts)); } if MarketPosition == -1 then { ExitShort("dsp",atlimit,EntryPrice-((당일수익-daypl)/CurrentContracts)); } /**********************************************************************/ if MarketPosition == 1 and Var5<Var12 Then exitlong("eB_b120"); if MarketPosition == -1 and Var5>Var12 Then ExitShort("eS_s120"); /* if MarketPosition == 1 and T == 1 and L > 고[1,1]* (1 - (전환비율/100)) Then ExitLong("eb_1",AtStop,고[1,1]* (1 - (전환비율/100))); if MarketPosition == -1 and T == -1 and H < 저[1,1]* (1 + (전환비율/100)) Then ExitShort("es_1",AtStop,저[1,1]* (1 + (전환비율/100))); */ SetStopProfittarget(익절,PointStop); SetStopLoss(손절,PointStop);
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2022-07-15 16:22:51

안녕하세요 예스스탁입니다. 선물사별로 프로그램 이름은 다르지만 예스랭귀지는 모두 동일하게 동작합니다. 차트의 데이타를 읽어 계산하게 됩니다. 2개의 회사가 신호가 다르면 데이타의 차이때문입니다. 차트의 데이타가 동일하면 동일결과가 나오게 됩니다. Input:전환비율(5); input : StartTime(070000),EndTime(060000); Input :익절(500),손절(200),당일수익(900),당일손실(800); Var : N1(0),dayPl(0),Tcond(false),Xcond(false); Var : j(0),jj(0),HH(0),LL(0),hiBar(0),loBar(0),최종꼭지점(""),처리구분(""); var : TL1(0),Text1(0),ADXV1(0),tl2(0),tl3(0),tx2(0),tx3(0),t(0); Array:고[10,4](0),저[10,4](0); if V == highest(V,120) Then var5 = (C+H+L)/3; #120거래선# if V == highest(V,360) Then var12 = (C+H+L)/3; #360거래선# HH = H; LL = L; If Index == 0 Then { 고[1,1] = HH; 고[1,2] = 0; 고[1,3] = sDate; 고[1,4] = sTime; 저[1,1] = LL; 저[1,2] = 0; 저[1,3] = sDate; 저[1,4] = sTime; } If Index > 0 Then { hiBar = hiBar + 1; loBar = loBar + 1; } If HH[hiBar] < HH Then hiBar = 0; If LL[loBar] > LL Then loBar = 0; Condition1 = 저[1,1] * (1 + (전환비율/100)) < HH and hiBar == 0; Condition2 = 고[1,1] * (1 - (전환비율/100)) > LL and loBar == 0; 처리구분 = ""; If Condition1 and Condition2 Then // 고점과 저점 조건 동시 만족 { If 최종꼭지점 == "저점" Then { If 저[1,1] > LL Then 처리구분 = "저점처리"; Else 처리구분 = "고점처리"; } Else If 최종꼭지점 == "고점" Then { If 고[1,1] < HH Then 처리구분 = "고점처리"; Else 처리구분 = "저점처리"; } } Else If Condition1 Then 처리구분 = "고점처리"; Else If Condition2 Then 처리구분 = "저점처리"; If 처리구분 == "고점처리" Then { T = 1; If 최종꼭지점 == "저점" Then { TL_SetEnd(TL2,저[1,3],저[1,4],고[1,1]* (1 - (전환비율/100)) ); Text_SetLocation(TX2,저[1,3],저[1,4],고[1,1]* (1 - (전환비율/100)) ); For j = 10 DownTo 2 { For jj = 1 To 4 { 고[j,jj] = 고[j-1,jj]; } } 고[1,1] = HH[hiBar]; 고[1,2] = Index - hiBar; 고[1,3] = sDate[hiBar]; 고[1,4] = sTime[hiBar]; hiBar = -1; loBar = -1; TL1 = TL_New(저[1,3],저[1,4],저[1,1],고[1,3],고[1,4],고[1,1]); TL_SetSize(TL1,1); TL_SetColor(TL1,RED); TL2 = TL_New(고[1,3],고[1,4],고[1,1]*(1-(전환비율/100)) ,NextBarSdate,NextBarStime,고[1,1]*(1-(전환비율/100)) ); TL_SetColor(TL2,Cyan); TL_SetStyle(TL2,3); Tx2 = Text_New(NextBarSdate,NextBarStime,고[1,1]*(1-(전환비율/100)),NumToStr(고[1,1]*(1-(전환비율/100)),2)); Text_SetColor(Tx2,Cyan); } Else If 고[1,1] < HH[hiBar] Then // 1번 고점보다 높은 고가 출현 { 고[1,1] = HH[hiBar]; 고[1,2] = Index - hiBar; 고[1,3] = sDate[hiBar]; 고[1,4] = sTime[hiBar]; hiBar = -1; loBar = -1; TL_SetEnd(TL1,고[1,3],고[1,4],고[1,1]); TL_SetBegin(TL2,고[1,3],고[1,4],고[1,1]* (1-(전환비율/100)) ); Text_SetString(TX2,NumToStr(고[1,1]*(1-(전환비율/100)),2)); } 최종꼭지점 = "고점"; } If 처리구분 == "저점처리" Then { t = -1; If 최종꼭지점 == "고점" Then { TL_SetEnd(TL3,고[1,3],고[1,4],저[1,1]* (1 + (전환비율/100)) ); Text_SetLocation(TX3,고[1,3],고[1,4],저[1,1]* (1 + (전환비율/100)) ); For j = 10 DownTo 2 { For jj = 1 To 4 { 저[j,jj] = 저[j-1,jj]; } } 저[1,1] = LL[loBar]; 저[1,2] = Index - loBar; 저[1,3] = sDate[loBar]; 저[1,4] = sTime[loBar]; hiBar = -1; loBar = -1; TL1 = TL_New(고[1,3],고[1,4],고[1,1],저[1,3],저[1,4],저[1,1]); TL_SetSize(TL1,1); TL_SetColor(TL1,BLUE); TL3 = TL_New(저[1,3],저[1,4],저[1,1]* (1 + (전환비율/100)) ,NextBarSdate,NextBarStime,저[1,1]* (1 + (전환비율/100)) ); TL_SetColor(TL3,Magenta); TL_SetStyle(TL3,3); TX3 = Text_New(NextBarSdate,NextBarStime,저[1,1]*(1+(전환비율/100)),NumToStr(저[1,1]*(1+(전환비율/100)),2)); Text_SetColor(TX3,Magenta); } Else If 저[1,1] > LL[loBar] Then { 저[1,1] = LL[loBar]; 저[1,2] = Index - loBar; 저[1,3] = sDate[loBar]; 저[1,4] = sTime[loBar]; hiBar = -1; loBar = -1; TL_SetEnd(TL1,저[1,3],저[1,4],저[1,1]); TL_SetBegin(TL3,저[1,3],저[1,4],저[1,1]* (1 + (전환비율/100)) ); Text_SetString(TX3,NumToStr(저[1,1]*(1+(전환비율/100)),2)); } 최종꼭지점 = "저점"; } TL_SetEnd(TL2,NextBarSdate,NextBarStime,고[1,1]* (1 - (전환비율/100)) ); Text_SetLocation(TX2,NextBarSdate,NextBarStime,고[1,1]* (1 - (전환비율/100)) ); TL_SetEnd(TL3,NextBarSdate,NextBarStime,저[1,1]* (1 + (전환비율/100)) ); Text_SetLocation(TX3,NextBarSdate,NextBarStime,저[1,1]* (1 + (전환비율/100)) ); 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 Bdate != Bdate[1] Then { Tcond = true; Xcond = false; N1 = NetProfit; Xcond = false; N1 = NetProfit; if MarketPosition == 0 Then { if MarketPosition(1) == 1 Then Buy(); if MarketPosition(1) == -1 Then Sell(); } IF Endtime <= starttime Then { SetStopEndofday(0); } } daypl = NetProfit-N1; if TotalTrades > TotalTrades[1] then { if daypl >= 당일수익 or daypl <= -당일손실 Then Xcond = true; if IsExitName("dbp",1) == true or IsExitName("dsp",1) == true or IsExitName("dbl",1) == true or IsExitName("dsl",1) == true then Xcond = true; } if Tcond == true and Xcond == false then { if MarketPosition >= 0 and T == 1 and L > 고[1,1]* (1 - (전환비율/100)) and Var5<var12 Then Sell("s",AtStop,고[1,1]* (1 - (전환비율/100))); if MarketPosition <= 0 and T == -1 and H < 저[1,1]* (1 + (전환비율/100)) and Var5>var12 Then Buy("b",AtStop,저[1,1]* (1 + (전환비율/100))); } if MarketPosition == 1 then { ExitLong("dbp",atlimit,EntryPrice+((당일수익-daypl)/CurrentContracts)); ExitLong("dbl",AtStop,EntryPrice-((당일손실+daypl)/CurrentContracts)); } if MarketPosition == -1 then { ExitShort("dsp",atlimit,EntryPrice-((당일수익-daypl)/CurrentContracts)); ExitShort("dsl",AtStop,EntryPrice+((당일손실+daypl)/CurrentContracts)); } /**********************************************************************/ if MarketPosition == 1 and Var5<Var12 Then exitlong("eB_b120"); if MarketPosition == -1 and Var5>Var12 Then ExitShort("eS_s120"); /* if MarketPosition == 1 and T == 1 and L > 고[1,1]* (1 - (전환비율/100)) Then ExitLong("eb_1",AtStop,고[1,1]* (1 - (전환비율/100))); if MarketPosition == -1 and T == -1 and H < 저[1,1]* (1 + (전환비율/100)) Then ExitShort("es_1",AtStop,저[1,1]* (1 + (전환비율/100))); */ SetStopProfittarget(익절,PointStop); SetStopLoss(손절,PointStop); 즐거운 하루되세요 > 제이디1 님이 쓴 글입니다. > 제목 : 수식 부탁드립니다. > 더운데 고생 많으십니다. 1.아래 수식에 당일손절(800) 추가 해 주세요. 2.전일 마지막신호가 매수였다면, 당일 시작과 동시에 매수진입이 될수 있게 해 주세요. 3.같은 수식을 이베스트하고 nh선물에 적용하면 거래선이 틀리던데, 왜 그럴까요? ================================================================================ Input:전환비율(5); input : StartTime(070000),EndTime(060000); Input :익절(500),손절(200),당일수익(900); Var : N1(0),dayPl(0),Tcond(false),Xcond(false); Var : j(0),jj(0),HH(0),LL(0),hiBar(0),loBar(0),최종꼭지점(""),처리구분(""); var : TL1(0),Text1(0),ADXV1(0),tl2(0),tl3(0),tx2(0),tx3(0),t(0); Array:고[10,4](0),저[10,4](0); if V == highest(V,120) Then var5 = (C+H+L)/3; #120거래선# if V == highest(V,360) Then var12 = (C+H+L)/3; #360거래선# HH = H; LL = L; If Index == 0 Then { 고[1,1] = HH; 고[1,2] = 0; 고[1,3] = sDate; 고[1,4] = sTime; 저[1,1] = LL; 저[1,2] = 0; 저[1,3] = sDate; 저[1,4] = sTime; } If Index > 0 Then { hiBar = hiBar + 1; loBar = loBar + 1; } If HH[hiBar] < HH Then hiBar = 0; If LL[loBar] > LL Then loBar = 0; Condition1 = 저[1,1] * (1 + (전환비율/100)) < HH and hiBar == 0; Condition2 = 고[1,1] * (1 - (전환비율/100)) > LL and loBar == 0; 처리구분 = ""; If Condition1 and Condition2 Then // 고점과 저점 조건 동시 만족 { If 최종꼭지점 == "저점" Then { If 저[1,1] > LL Then 처리구분 = "저점처리"; Else 처리구분 = "고점처리"; } Else If 최종꼭지점 == "고점" Then { If 고[1,1] < HH Then 처리구분 = "고점처리"; Else 처리구분 = "저점처리"; } } Else If Condition1 Then 처리구분 = "고점처리"; Else If Condition2 Then 처리구분 = "저점처리"; If 처리구분 == "고점처리" Then { T = 1; If 최종꼭지점 == "저점" Then { TL_SetEnd(TL2,저[1,3],저[1,4],고[1,1]* (1 - (전환비율/100)) ); Text_SetLocation(TX2,저[1,3],저[1,4],고[1,1]* (1 - (전환비율/100)) ); For j = 10 DownTo 2 { For jj = 1 To 4 { 고[j,jj] = 고[j-1,jj]; } } 고[1,1] = HH[hiBar]; 고[1,2] = Index - hiBar; 고[1,3] = sDate[hiBar]; 고[1,4] = sTime[hiBar]; hiBar = -1; loBar = -1; TL1 = TL_New(저[1,3],저[1,4],저[1,1],고[1,3],고[1,4],고[1,1]); TL_SetSize(TL1,1); TL_SetColor(TL1,RED); TL2 = TL_New(고[1,3],고[1,4],고[1,1]*(1-(전환비율/100)) ,NextBarSdate,NextBarStime,고[1,1]*(1-(전환비율/100)) ); TL_SetColor(TL2,Cyan); TL_SetStyle(TL2,3); Tx2 = Text_New(NextBarSdate,NextBarStime,고[1,1]*(1-(전환비율/100)),NumToStr(고[1,1]*(1-(전환비율/100)),2)); Text_SetColor(Tx2,Cyan); } Else If 고[1,1] < HH[hiBar] Then // 1번 고점보다 높은 고가 출현 { 고[1,1] = HH[hiBar]; 고[1,2] = Index - hiBar; 고[1,3] = sDate[hiBar]; 고[1,4] = sTime[hiBar]; hiBar = -1; loBar = -1; TL_SetEnd(TL1,고[1,3],고[1,4],고[1,1]); TL_SetBegin(TL2,고[1,3],고[1,4],고[1,1]* (1-(전환비율/100)) ); Text_SetString(TX2,NumToStr(고[1,1]*(1-(전환비율/100)),2)); } 최종꼭지점 = "고점"; } If 처리구분 == "저점처리" Then { t = -1; If 최종꼭지점 == "고점" Then { TL_SetEnd(TL3,고[1,3],고[1,4],저[1,1]* (1 + (전환비율/100)) ); Text_SetLocation(TX3,고[1,3],고[1,4],저[1,1]* (1 + (전환비율/100)) ); For j = 10 DownTo 2 { For jj = 1 To 4 { 저[j,jj] = 저[j-1,jj]; } } 저[1,1] = LL[loBar]; 저[1,2] = Index - loBar; 저[1,3] = sDate[loBar]; 저[1,4] = sTime[loBar]; hiBar = -1; loBar = -1; TL1 = TL_New(고[1,3],고[1,4],고[1,1],저[1,3],저[1,4],저[1,1]); TL_SetSize(TL1,1); TL_SetColor(TL1,BLUE); TL3 = TL_New(저[1,3],저[1,4],저[1,1]* (1 + (전환비율/100)) ,NextBarSdate,NextBarStime,저[1,1]* (1 + (전환비율/100)) ); TL_SetColor(TL3,Magenta); TL_SetStyle(TL3,3); TX3 = Text_New(NextBarSdate,NextBarStime,저[1,1]*(1+(전환비율/100)),NumToStr(저[1,1]*(1+(전환비율/100)),2)); Text_SetColor(TX3,Magenta); } Else If 저[1,1] > LL[loBar] Then { 저[1,1] = LL[loBar]; 저[1,2] = Index - loBar; 저[1,3] = sDate[loBar]; 저[1,4] = sTime[loBar]; hiBar = -1; loBar = -1; TL_SetEnd(TL1,저[1,3],저[1,4],저[1,1]); TL_SetBegin(TL3,저[1,3],저[1,4],저[1,1]* (1 + (전환비율/100)) ); Text_SetString(TX3,NumToStr(저[1,1]*(1+(전환비율/100)),2)); } 최종꼭지점 = "저점"; } TL_SetEnd(TL2,NextBarSdate,NextBarStime,고[1,1]* (1 - (전환비율/100)) ); Text_SetLocation(TX2,NextBarSdate,NextBarStime,고[1,1]* (1 - (전환비율/100)) ); TL_SetEnd(TL3,NextBarSdate,NextBarStime,저[1,1]* (1 + (전환비율/100)) ); Text_SetLocation(TX3,NextBarSdate,NextBarStime,저[1,1]* (1 + (전환비율/100)) ); 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 Bdate != Bdate[1] Then { Tcond = true; Xcond = false; N1 = NetProfit; IF Endtime <= starttime Then { SetStopEndofday(0); } } daypl = NetProfit-N1; if TotalTrades > TotalTrades[1] then { if daypl >= 당일수익 Then Xcond = true; if (IsExitName("dbp",1) == true or IsExitName("dsp",1) == true) then Xcond = true; } if Tcond == true and Xcond == false then { if MarketPosition >= 0 and T == 1 and L > 고[1,1]* (1 - (전환비율/100)) and Var5<var12 Then Sell("s",AtStop,고[1,1]* (1 - (전환비율/100))); if MarketPosition <= 0 and T == -1 and H < 저[1,1]* (1 + (전환비율/100)) and Var5>var12 Then Buy("b",AtStop,저[1,1]* (1 + (전환비율/100))); } if MarketPosition == 1 then { ExitLong("dbp",atlimit,EntryPrice+((당일수익-daypl)/CurrentContracts)); } if MarketPosition == -1 then { ExitShort("dsp",atlimit,EntryPrice-((당일수익-daypl)/CurrentContracts)); } /**********************************************************************/ if MarketPosition == 1 and Var5<Var12 Then exitlong("eB_b120"); if MarketPosition == -1 and Var5>Var12 Then ExitShort("eS_s120"); /* if MarketPosition == 1 and T == 1 and L > 고[1,1]* (1 - (전환비율/100)) Then ExitLong("eb_1",AtStop,고[1,1]* (1 - (전환비율/100))); if MarketPosition == -1 and T == -1 and H < 저[1,1]* (1 + (전환비율/100)) Then ExitShort("es_1",AtStop,저[1,1]* (1 + (전환비율/100))); */ SetStopProfittarget(익절,PointStop); SetStopLoss(손절,PointStop);