커뮤니티

시스템 문의합니다

프로필 이미지
가날
2020-06-24 08:21:59
1836
글번호 140106
답변완료
1번질문 1번식은 매수 버전 2번식은 매도 버전인데요 1-2번을 합쳤을때 1번의 모든 변수(28개)와 2번의 모든변수(22개)를 각각 따로 변수값을 지정할수있게 합칠수있나요? 총 50개값으로 지정할수있게 가능한가요? 매수일때 조건하고 매도 조건을 각각 따로따로 지정하고 싶어서 그런건데 가능하며 부탁드립니다 2번질문 혹시 손실이 마니나는 시스템을 buy랑 sell 만 바꾼다고해서 그손실이 수익으로 바뀌는개념은 불가능한 부분이겠죠? -----------------------------------1번--- Input : RSIPeriod(7),RSI매수값(28),SimPeriod(14),심리도값(36); # RSI와 심리도 기간 및 값 변수 Input : N1(1),초기화(3); # 위 해당 조건 발생후 진입 유효 기간, 7일경과후 초기화 Input : 하락틱수(2); # 해당 조건 발생후 하락틱수만큼 하락후 진입 변수 Input : RSIPeriod1(6),A(0),B(4),D(48),E(72); # 일봉기준 RSI값이 해당변수안에 속해있을때 진입 변수 Input : 거래량1(600),거래량평균봉수(55),거래량평균봉수비율(3.6); # 해당 거래량1,2 사이에 속해 있을때 진입되는 변수 18000 # 1일 1회 거래 # 청산 조건 변수 Input : CCI기간(20),CCI값(500); # CCI값에 의해 청산 수식 변수 Input : 즉시익절1(70),즉시손절1(90); # 익절값 손절값 변수 Input : N2(0.6),N3(0.15); # 상승후 본절청산 관련 수식 Input : tr수익(70),tr하락(25); # 트레일링 관련 수식 Input : N4(0.7),본전생각틱(10); # 하락후 본절청산 관련 수식 Input : N5(0.8),CCI값1(120); # 약 손절 관련 수식 Input : 터치익절(105); var : cnt(0),SigSum(0),count2(0),RSIsig(0); Var : Counter(0), DownAmt(0), UpAmt(0), UpSum(0), DownSum(0), UpAvg(0), DownAvg(0); var : idx(0), PreUpAvg(0), preDownAvg(0),RSIVv(0); Array : C1[100](0); var : CCIv(0),RSIv(0),Simri(0),BuySetup(false),DD(0),entry(0); CCIv = CCI(CCI기간); RSIV = RSI(RSIPeriod); Simri = Simrido(SimPeriod); var4 = ma(V,20); if Bdate != Bdate[1] Then { for cnt = 1 to 99 { C1[cnt] = C1[cnt-1][1]; } PreUpAvg = UpAvg[1]; preDownAvg = DownAvg[1]; idx = idx + 1; } C1[0] = C; If idx == RSIPeriod1+2 Then { UpSum = 0; DownSum = 0; For Counter = 0 To RSIPeriod1 - 1 { UpAmt = C1[Counter] - C1[Counter+1]; If UpAmt >= 0 Then DownAmt = 0; Else { DownAmt = -UpAmt; UpAmt = 0; } UpSum = UpSum + UpAmt; DownSum = DownSum + DownAmt; } UpAvg = UpSum / RSIPeriod1; DownAvg = DownSum / RSIPeriod1; } If idx > RSIPeriod1+2 Then { UpAmt = C1[0] - C1[1]; If UpAmt >= 0 Then DownAmt = 0; Else { DownAmt = -UpAmt; UpAmt = 0; } UpAvg = (PreUpAvg * (RSIPeriod1 - 1) + UpAmt) / RSIPeriod1; DownAvg = (preDownAvg * (RSIPeriod1 - 1) + DownAmt) / RSIPeriod1; } If UpAvg + DownAvg <> 0 Then RSIvv = 100 * UpAvg / (UpAvg + DownAvg); Else RSIvv = 0; if bdate != bdate[1] Then { Entry = 0; Condition2 = true; } if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then entry = entry+1; if TotalTrades > TotalTrades[1] and (IsExitName("즉시손절1",1) == true or IsExitName("본전청산1",1)) then Condition2 = false; Condition1 = RSIv < RSI매수값 and Simri < 심리도값 and ((RSIVV > A and RSIVV < B) or (RSIVV > D and RSIVV < E)) ; if bdate != bdate[1] Then { DD = DD+1; if var2 > 0 and DD == var2+초기화 Then BuySetup = false; } if BuySetup == false and Condition1 == true and Condition1[1] == false Then { var1 = C; var2 = DD; BuySetup = true; } if Condition2 == true and MarketPosition == 0 and C < O and C[1] < O and BuySetup == true and entry == 0 and v < ma(v,거래량평균봉수)*거래량평균봉수비율 and v > 거래량1 Then # and C < O { buy("매수",AtLimit,var1-PriceScale*하락틱수); ExitLong("즉시손절1",AtStop,EntryPrice-PriceScale*즉시손절1); } if MarketPosition == 1 then { BuySetup = false; if countif(CrossDown(CCIv,CCI값),BarsSinceEntry) >= 1 and CCIv < CCI값 and C < O Then ExitLong("매수cci청산",OnClose); if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*즉시익절1 and C < O Then ExitLong("즉시익절1",OnClose); if highest(H,BarsSinceEntry) >= (EntryPrice+PriceScale*즉시익절1*N2) Then ExitLong("본전청산1",AtStop,EntryPrice+PriceScale*즉시익절1*N3); if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*tr수익 Then ExitLong("tr",AtStop, highest(H,BarsSinceEntry)-PriceScale*tr하락); if lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*즉시손절1*N4 and C < O Then ExitLong("저점에서 올라와서 본전 청산",atlimit,EntryPrice+PriceScale*본전생각틱); if lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*즉시손절1 *N5 and CCIv >= CCI값1 and C < O Then ExitLong("저점에서 올라와서 약손절",OnClose); } SetStopLoss(PriceScale*즉시손절1,PointStop); SetStopProfittarget(PriceScale*터치익절,PointStop); -----------2번---- # 매도 진입 조건 변수 Input : RSIPeriod(7),RSI매수값(65),SimPeriod(7),심리도값(45); Input : N1(1),초기화(2); Input : 하락틱수(5); Input : RSIPeriod1(6),A(14),B(40),D(88),E(100); Input : 거래량1(100),거래량평균봉수(60),거래량평균봉수비율(4); # Input : 거래량1(100),거래량2(22000); # 청산 조건 변수 Input : 즉시익절1(70),즉시손절1(70); Input : N2(0.25),N3(-0.75); Input : tr수익(75),tr하락(55); Input : N4(0.45),본전생각틱(55); Input : 터치익절(115); var : cnt(0),SigSum(0),count2(0),RSIsig(0); Var : Counter(0), DownAmt(0), UpAmt(0), UpSum(0), DownSum(0), UpAvg(0), DownAvg(0); var : idx(0), PreUpAvg(0), preDownAvg(0),RSIVv(0); Array : C1[100](0); var : CCIv(0),RSIv(0),Simri(0),SellSetup(false),DD(0),entry(0); RSIV = RSI(RSIPeriod); Simri = Simrido(SimPeriod); if Bdate != Bdate[1] Then { for cnt = 1 to 99 { C1[cnt] = C1[cnt-1][1]; } PreUpAvg = UpAvg[1]; preDownAvg = DownAvg[1]; idx = idx + 1; } C1[0] = C; If idx == RSIPeriod1+2 Then { UpSum = 0; DownSum = 0; For Counter = 0 To RSIPeriod1 - 1 { UpAmt = C1[Counter] - C1[Counter+1]; If UpAmt >= 0 Then DownAmt = 0; Else { DownAmt = -UpAmt; UpAmt = 0; } UpSum = UpSum + UpAmt; DownSum = DownSum + DownAmt; } UpAvg = UpSum / RSIPeriod1; DownAvg = DownSum / RSIPeriod1; } If idx > RSIPeriod1+2 Then { UpAmt = C1[0] - C1[1]; If UpAmt >= 0 Then DownAmt = 0; Else { DownAmt = -UpAmt; UpAmt = 0; } UpAvg = (PreUpAvg * (RSIPeriod1 - 1) + UpAmt) / RSIPeriod1; DownAvg = (preDownAvg * (RSIPeriod1 - 1) + DownAmt) / RSIPeriod1; } If UpAvg + DownAvg <> 0 Then RSIvv = 100 * UpAvg / (UpAvg + DownAvg); Else RSIvv = 0; if bdate != bdate[1] Then { Entry = 0; Condition2 = true; } if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then entry = entry+1; if TotalTrades > TotalTrades[1] and (IsExitName("즉시손절1",1) == true or IsExitName("본전청산1",1)) then Condition2 = false; Condition1 = RSIv > RSI매수값 and Simri > 심리도값 and ((RSIVV > A and RSIVV < B) or (RSIVV > D and RSIVV < E)) ; if bdate != bdate[1] Then { DD = DD+1; if var2 > 0 and DD == var2+초기화 Then SellSetup = false; } if SellSetup == false and Condition1 == true and Condition1[1] == false Then { var1 = C; var2 = DD; SellSetup = true; } if Condition2 == true and MarketPosition == 0 and SellSetup == true and C > O and entry == 0 and v > 거래량1 and v < ma(v,거래량평균봉수)*거래량평균봉수비율 Then sell("매도",AtStop,var1+PriceScale*하락틱수); if MarketPosition == -1 then { SellSetup = false; SetStopProfittarget(PriceScale*터치익절,PointStop); if Lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*즉시익절1 and C > O Then ExitShort("s즉시익절1",OnClose); if Lowest(L,BarsSinceEntry) <= (EntryPrice-PriceScale*즉시익절1*N2) Then ExitShort("s본전청산1",AtStop,EntryPrice-PriceScale*즉시익절1*N3); if Lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*tr수익 Then ExitShort("str",AtStop, Lowest(L,BarsSinceEntry)+PriceScale*tr하락); if Highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*즉시손절1*N4 and C > O Then ExitShort("s고점에서 내려와서 본전 청산",atlimit,EntryPrice-PriceScale*본전생각틱); } SetStopLoss(PriceScale*즉시손절1,PointStop); SetStopProfittarget(PriceScale*터치익절,PointStop);
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2020-06-24 14:16:59

안녕하세요 예스스탁입니다. 1 input변수뿐만아니라 var변수도 모두 다른이름으로 만들어 사용되어야 합니다. 매도쪽 변수명 앞에 s를 붙여 분리되게 작성해 드립니다. Input : RSIPeriod(7),RSI매수값(28),SimPeriod(14),심리도값(36); # RSI와 심리도 기간 및 값 변수 Input : N1(1),초기화(3); # 위 해당 조건 발생후 진입 유효 기간, 7일경과후 초기화 Input : 하락틱수(2); # 해당 조건 발생후 하락틱수만큼 하락후 진입 변수 Input : RSIPeriod1(6),A(0),B(4),D(48),E(72); # 일봉기준 RSI값이 해당변수안에 속해있을때 진입 변수 Input : 거래량1(600),거래량평균봉수(55),거래량평균봉수비율(3.6); # 해당 거래량1,2 사이에 속해 있을때 진입되는 변수 18000 # 1일 1회 거래 # 청산 조건 변수 Input : CCI기간(20),CCI값(500); # CCI값에 의해 청산 수식 변수 Input : 즉시익절1(70),즉시손절1(90); # 익절값 손절값 변수 Input : N2(0.6),N3(0.15); # 상승후 본절청산 관련 수식 Input : tr수익(70),tr하락(25); # 트레일링 관련 수식 Input : N4(0.7),본전생각틱(10); # 하락후 본절청산 관련 수식 Input : N5(0.8),CCI값1(120); # 약 손절 관련 수식 Input : 터치익절(105); var : cnt(0),SigSum(0),count2(0),RSIsig(0); Var : Counter(0), DownAmt(0), UpAmt(0), UpSum(0), DownSum(0), UpAvg(0), DownAvg(0); var : idx(0), PreUpAvg(0), preDownAvg(0),RSIVv(0); Array : C1[100](0); var : CCIv(0),RSIv(0),Simri(0),BuySetup(false),DD(0),entry(0); CCIv = CCI(CCI기간); RSIV = RSI(RSIPeriod); Simri = Simrido(SimPeriod); var4 = ma(V,20); if Bdate != Bdate[1] Then { for cnt = 1 to 99 { C1[cnt] = C1[cnt-1][1]; } PreUpAvg = UpAvg[1]; preDownAvg = DownAvg[1]; idx = idx + 1; } C1[0] = C; If idx == RSIPeriod1+2 Then { UpSum = 0; DownSum = 0; For Counter = 0 To RSIPeriod1 - 1 { UpAmt = C1[Counter] - C1[Counter+1]; If UpAmt >= 0 Then DownAmt = 0; Else { DownAmt = -UpAmt; UpAmt = 0; } UpSum = UpSum + UpAmt; DownSum = DownSum + DownAmt; } UpAvg = UpSum / RSIPeriod1; DownAvg = DownSum / RSIPeriod1; } If idx > RSIPeriod1+2 Then { UpAmt = C1[0] - C1[1]; If UpAmt >= 0 Then DownAmt = 0; Else { DownAmt = -UpAmt; UpAmt = 0; } UpAvg = (PreUpAvg * (RSIPeriod1 - 1) + UpAmt) / RSIPeriod1; DownAvg = (preDownAvg * (RSIPeriod1 - 1) + DownAmt) / RSIPeriod1; } If UpAvg + DownAvg <> 0 Then RSIvv = 100 * UpAvg / (UpAvg + DownAvg); Else RSIvv = 0; if bdate != bdate[1] Then { Entry = 0; Condition2 = true; } if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then entry = entry+1; if TotalTrades > TotalTrades[1] and (IsExitName("즉시손절1",1) == true or IsExitName("본전청산1",1)) then Condition2 = false; Condition1 = RSIv < RSI매수값 and Simri < 심리도값 and ((RSIVV > A and RSIVV < B) or (RSIVV > D and RSIVV < E)) ; if bdate != bdate[1] Then { DD = DD+1; if var2 > 0 and DD == var2+초기화 Then BuySetup = false; } if BuySetup == false and Condition1 == true and Condition1[1] == false Then { var1 = C; var2 = DD; BuySetup = true; } if Condition2 == true and MarketPosition == 0 and C < O and C[1] < O and BuySetup == true and entry == 0 and v < ma(v,거래량평균봉수)*거래량평균봉수비율 and v > 거래량1 Then # and C < O { buy("매수",AtLimit,var1-PriceScale*하락틱수); ExitLong("즉시손절1",AtStop,EntryPrice-PriceScale*즉시손절1); } if MarketPosition == 1 then { BuySetup = false; if countif(CrossDown(CCIv,CCI값),BarsSinceEntry) >= 1 and CCIv < CCI값 and C < O Then ExitLong("매수cci청산",OnClose); if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*즉시익절1 and C < O Then ExitLong("즉시익절1",OnClose); if highest(H,BarsSinceEntry) >= (EntryPrice+PriceScale*즉시익절1*N2) Then ExitLong("본전청산1",AtStop,EntryPrice+PriceScale*즉시익절1*N3); if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*tr수익 Then ExitLong("tr",AtStop, highest(H,BarsSinceEntry)-PriceScale*tr하락); if lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*즉시손절1*N4 and C < O Then ExitLong("저점에서 올라와서 본전 청산",atlimit,EntryPrice+PriceScale*본전생각틱); if lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*즉시손절1 *N5 and CCIv >= CCI값1 and C < O Then ExitLong("저점에서 올라와서 약손절",OnClose); } if MarketPosition == 1 then { SetStopLoss(PriceScale*즉시손절1,PointStop); SetStopProfittarget(PriceScale*터치익절,PointStop); } Input : sRSIPeriod(7),sRSI매수값(65),sSimPeriod(7),s심리도값(45); Input : sN1(1),s초기화(2); Input : s하락틱수(5); Input : sRSIPeriod1(6),sA(14),sB(40),sD(88),sE(100); Input : s거래량1(100),s거래량평균봉수(60),s거래량평균봉수비율(4); # Input : 거래량1(100),거래량2(22000); # 청산 조건 변수 Input : s즉시익절1(70),s즉시손절1(70); Input : sN2(0.25),sN3(-0.75); Input : str수익(75),str하락(55); Input : sN4(0.45),s본전생각틱(55); Input : s터치익절(115); var : scnt(0),sSigSum(0),scount2(0),sRSIsig(0); Var : sCounter(0),sDownAmt(0),sUpAmt(0),sUpSum(0),sDownSum(0),sUpAvg(0),sDownAvg(0); var : sidx(0),sPreUpAvg(0),spreDownAvg(0),sRSIVv(0); Array : sC1[100](0); var : sCCIv(0),sRSIv(0),sSimri(0),sSellSetup(false),sDD(0),sentry(0); var : sCondition1(false),sCondition2(false),svar2(0),svar1(0); sRSIV = RSI(sRSIPeriod); sSimri = Simrido(sSimPeriod); if Bdate != Bdate[1] Then { for scnt = 1 to 99 { sC1[scnt] = sC1[scnt-1][1]; } sPreUpAvg = sUpAvg[1]; spreDownAvg = sDownAvg[1]; sidx = sidx + 1; } sC1[0] = C; If sidx == sRSIPeriod1+2 Then { sUpSum = 0; sDownSum = 0; For sCounter = 0 To sRSIPeriod1 - 1 { sUpAmt = sC1[sCounter] - sC1[sCounter+1]; If sUpAmt >= 0 Then sDownAmt = 0; Else { sDownAmt = -sUpAmt; sUpAmt = 0; } sUpSum = sUpSum + sUpAmt; sDownSum = sDownSum + sDownAmt; } sUpAvg = sUpSum / sRSIPeriod1; sDownAvg = sDownSum / sRSIPeriod1; } If sidx > sRSIPeriod1+2 Then { sUpAmt = sC1[0] - sC1[1]; If sUpAmt >= 0 Then sDownAmt = 0; Else { sDownAmt = -sUpAmt; sUpAmt = 0; } sUpAvg = (sPreUpAvg * (sRSIPeriod1 - 1) + sUpAmt) / sRSIPeriod1; sDownAvg = (spreDownAvg * (sRSIPeriod1 - 1) + sDownAmt) / sRSIPeriod1; } If sUpAvg + sDownAvg <> 0 Then sRSIvv = 100 * sUpAvg / (sUpAvg + sDownAvg); Else sRSIvv = 0; if bdate != bdate[1] Then { sEntry = 0; sCondition2 = true; } if MarketPosition == -1 and MarketPosition != MarketPosition[1] Then sentry = sentry+1; if TotalTrades > TotalTrades[1] and (IsExitName("s즉시손절1",1) == true or IsExitName("s본전청산1",1)) then Condition2 = false; sCondition1 = sRSIv > sRSI매수값 and sSimri > s심리도값 and ((sRSIVV > sA and sRSIVV < sB) or (sRSIVV > sD and sRSIVV < sE)) ; if bdate != bdate[1] Then { sDD = sDD+1; if svar2 > 0 and sDD == svar2+s초기화 Then sSellSetup = false; } if sSellSetup == false and sCondition1 == true and sCondition1[1] == false Then { svar1 = C; svar2 = sDD; sSellSetup = true; } if sCondition2 == true and MarketPosition == 0 and sSellSetup == true and C > O and sentry == 0 and v > s거래량1 and v < ma(v,s거래량평균봉수)*s거래량평균봉수비율 Then sell("매도",AtStop,svar1+PriceScale*s하락틱수); if MarketPosition == -1 then { sSellSetup = false; SetStopProfittarget(PriceScale*s터치익절,PointStop); if Lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*s즉시익절1 and C > O Then ExitShort("s즉시익절1",OnClose); if Lowest(L,BarsSinceEntry) <= (EntryPrice-PriceScale*s즉시익절1*sN2) Then ExitShort("s본전청산1",AtStop,EntryPrice-PriceScale*s즉시익절1*sN3); if Lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*str수익 Then ExitShort("str",AtStop, Lowest(L,BarsSinceEntry)+PriceScale*str하락); if Highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*s즉시손절1*sN4 and C > O Then ExitShort("s고점에서 내려와서 본전 청산",atlimit,EntryPrice-PriceScale*s본전생각틱); } if MarketPosition == 1 then { SetStopLoss(PriceScale*s즉시손절1,PointStop); SetStopProfittarget(PriceScale*s터치익절,PointStop); } 2 일반적으로 손실나는 전략을 신호를 반대로 해서 사용하거나 하지는 않습니다. 즐거운 하루되세요 > 가날 님이 쓴 글입니다. > 제목 : 시스템 문의합니다 > 1번질문 1번식은 매수 버전 2번식은 매도 버전인데요 1-2번을 합쳤을때 1번의 모든 변수(28개)와 2번의 모든변수(22개)를 각각 따로 변수값을 지정할수있게 합칠수있나요? 총 50개값으로 지정할수있게 가능한가요? 매수일때 조건하고 매도 조건을 각각 따로따로 지정하고 싶어서 그런건데 가능하며 부탁드립니다 2번질문 혹시 손실이 마니나는 시스템을 buy랑 sell 만 바꾼다고해서 그손실이 수익으로 바뀌는개념은 불가능한 부분이겠죠? -----------------------------------1번--- Input : RSIPeriod(7),RSI매수값(28),SimPeriod(14),심리도값(36); # RSI와 심리도 기간 및 값 변수 Input : N1(1),초기화(3); # 위 해당 조건 발생후 진입 유효 기간, 7일경과후 초기화 Input : 하락틱수(2); # 해당 조건 발생후 하락틱수만큼 하락후 진입 변수 Input : RSIPeriod1(6),A(0),B(4),D(48),E(72); # 일봉기준 RSI값이 해당변수안에 속해있을때 진입 변수 Input : 거래량1(600),거래량평균봉수(55),거래량평균봉수비율(3.6); # 해당 거래량1,2 사이에 속해 있을때 진입되는 변수 18000 # 1일 1회 거래 # 청산 조건 변수 Input : CCI기간(20),CCI값(500); # CCI값에 의해 청산 수식 변수 Input : 즉시익절1(70),즉시손절1(90); # 익절값 손절값 변수 Input : N2(0.6),N3(0.15); # 상승후 본절청산 관련 수식 Input : tr수익(70),tr하락(25); # 트레일링 관련 수식 Input : N4(0.7),본전생각틱(10); # 하락후 본절청산 관련 수식 Input : N5(0.8),CCI값1(120); # 약 손절 관련 수식 Input : 터치익절(105); var : cnt(0),SigSum(0),count2(0),RSIsig(0); Var : Counter(0), DownAmt(0), UpAmt(0), UpSum(0), DownSum(0), UpAvg(0), DownAvg(0); var : idx(0), PreUpAvg(0), preDownAvg(0),RSIVv(0); Array : C1[100](0); var : CCIv(0),RSIv(0),Simri(0),BuySetup(false),DD(0),entry(0); CCIv = CCI(CCI기간); RSIV = RSI(RSIPeriod); Simri = Simrido(SimPeriod); var4 = ma(V,20); if Bdate != Bdate[1] Then { for cnt = 1 to 99 { C1[cnt] = C1[cnt-1][1]; } PreUpAvg = UpAvg[1]; preDownAvg = DownAvg[1]; idx = idx + 1; } C1[0] = C; If idx == RSIPeriod1+2 Then { UpSum = 0; DownSum = 0; For Counter = 0 To RSIPeriod1 - 1 { UpAmt = C1[Counter] - C1[Counter+1]; If UpAmt >= 0 Then DownAmt = 0; Else { DownAmt = -UpAmt; UpAmt = 0; } UpSum = UpSum + UpAmt; DownSum = DownSum + DownAmt; } UpAvg = UpSum / RSIPeriod1; DownAvg = DownSum / RSIPeriod1; } If idx > RSIPeriod1+2 Then { UpAmt = C1[0] - C1[1]; If UpAmt >= 0 Then DownAmt = 0; Else { DownAmt = -UpAmt; UpAmt = 0; } UpAvg = (PreUpAvg * (RSIPeriod1 - 1) + UpAmt) / RSIPeriod1; DownAvg = (preDownAvg * (RSIPeriod1 - 1) + DownAmt) / RSIPeriod1; } If UpAvg + DownAvg <> 0 Then RSIvv = 100 * UpAvg / (UpAvg + DownAvg); Else RSIvv = 0; if bdate != bdate[1] Then { Entry = 0; Condition2 = true; } if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then entry = entry+1; if TotalTrades > TotalTrades[1] and (IsExitName("즉시손절1",1) == true or IsExitName("본전청산1",1)) then Condition2 = false; Condition1 = RSIv < RSI매수값 and Simri < 심리도값 and ((RSIVV > A and RSIVV < B) or (RSIVV > D and RSIVV < E)) ; if bdate != bdate[1] Then { DD = DD+1; if var2 > 0 and DD == var2+초기화 Then BuySetup = false; } if BuySetup == false and Condition1 == true and Condition1[1] == false Then { var1 = C; var2 = DD; BuySetup = true; } if Condition2 == true and MarketPosition == 0 and C < O and C[1] < O and BuySetup == true and entry == 0 and v < ma(v,거래량평균봉수)*거래량평균봉수비율 and v > 거래량1 Then # and C < O { buy("매수",AtLimit,var1-PriceScale*하락틱수); ExitLong("즉시손절1",AtStop,EntryPrice-PriceScale*즉시손절1); } if MarketPosition == 1 then { BuySetup = false; if countif(CrossDown(CCIv,CCI값),BarsSinceEntry) >= 1 and CCIv < CCI값 and C < O Then ExitLong("매수cci청산",OnClose); if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*즉시익절1 and C < O Then ExitLong("즉시익절1",OnClose); if highest(H,BarsSinceEntry) >= (EntryPrice+PriceScale*즉시익절1*N2) Then ExitLong("본전청산1",AtStop,EntryPrice+PriceScale*즉시익절1*N3); if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*tr수익 Then ExitLong("tr",AtStop, highest(H,BarsSinceEntry)-PriceScale*tr하락); if lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*즉시손절1*N4 and C < O Then ExitLong("저점에서 올라와서 본전 청산",atlimit,EntryPrice+PriceScale*본전생각틱); if lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*즉시손절1 *N5 and CCIv >= CCI값1 and C < O Then ExitLong("저점에서 올라와서 약손절",OnClose); } SetStopLoss(PriceScale*즉시손절1,PointStop); SetStopProfittarget(PriceScale*터치익절,PointStop); -----------2번---- # 매도 진입 조건 변수 Input : RSIPeriod(7),RSI매수값(65),SimPeriod(7),심리도값(45); Input : N1(1),초기화(2); Input : 하락틱수(5); Input : RSIPeriod1(6),A(14),B(40),D(88),E(100); Input : 거래량1(100),거래량평균봉수(60),거래량평균봉수비율(4); # Input : 거래량1(100),거래량2(22000); # 청산 조건 변수 Input : 즉시익절1(70),즉시손절1(70); Input : N2(0.25),N3(-0.75); Input : tr수익(75),tr하락(55); Input : N4(0.45),본전생각틱(55); Input : 터치익절(115); var : cnt(0),SigSum(0),count2(0),RSIsig(0); Var : Counter(0), DownAmt(0), UpAmt(0), UpSum(0), DownSum(0), UpAvg(0), DownAvg(0); var : idx(0), PreUpAvg(0), preDownAvg(0),RSIVv(0); Array : C1[100](0); var : CCIv(0),RSIv(0),Simri(0),SellSetup(false),DD(0),entry(0); RSIV = RSI(RSIPeriod); Simri = Simrido(SimPeriod); if Bdate != Bdate[1] Then { for cnt = 1 to 99 { C1[cnt] = C1[cnt-1][1]; } PreUpAvg = UpAvg[1]; preDownAvg = DownAvg[1]; idx = idx + 1; } C1[0] = C; If idx == RSIPeriod1+2 Then { UpSum = 0; DownSum = 0; For Counter = 0 To RSIPeriod1 - 1 { UpAmt = C1[Counter] - C1[Counter+1]; If UpAmt >= 0 Then DownAmt = 0; Else { DownAmt = -UpAmt; UpAmt = 0; } UpSum = UpSum + UpAmt; DownSum = DownSum + DownAmt; } UpAvg = UpSum / RSIPeriod1; DownAvg = DownSum / RSIPeriod1; } If idx > RSIPeriod1+2 Then { UpAmt = C1[0] - C1[1]; If UpAmt >= 0 Then DownAmt = 0; Else { DownAmt = -UpAmt; UpAmt = 0; } UpAvg = (PreUpAvg * (RSIPeriod1 - 1) + UpAmt) / RSIPeriod1; DownAvg = (preDownAvg * (RSIPeriod1 - 1) + DownAmt) / RSIPeriod1; } If UpAvg + DownAvg <> 0 Then RSIvv = 100 * UpAvg / (UpAvg + DownAvg); Else RSIvv = 0; if bdate != bdate[1] Then { Entry = 0; Condition2 = true; } if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then entry = entry+1; if TotalTrades > TotalTrades[1] and (IsExitName("즉시손절1",1) == true or IsExitName("본전청산1",1)) then Condition2 = false; Condition1 = RSIv > RSI매수값 and Simri > 심리도값 and ((RSIVV > A and RSIVV < B) or (RSIVV > D and RSIVV < E)) ; if bdate != bdate[1] Then { DD = DD+1; if var2 > 0 and DD == var2+초기화 Then SellSetup = false; } if SellSetup == false and Condition1 == true and Condition1[1] == false Then { var1 = C; var2 = DD; SellSetup = true; } if Condition2 == true and MarketPosition == 0 and SellSetup == true and C > O and entry == 0 and v > 거래량1 and v < ma(v,거래량평균봉수)*거래량평균봉수비율 Then sell("매도",AtStop,var1+PriceScale*하락틱수); if MarketPosition == -1 then { SellSetup = false; SetStopProfittarget(PriceScale*터치익절,PointStop); if Lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*즉시익절1 and C > O Then ExitShort("s즉시익절1",OnClose); if Lowest(L,BarsSinceEntry) <= (EntryPrice-PriceScale*즉시익절1*N2) Then ExitShort("s본전청산1",AtStop,EntryPrice-PriceScale*즉시익절1*N3); if Lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*tr수익 Then ExitShort("str",AtStop, Lowest(L,BarsSinceEntry)+PriceScale*tr하락); if Highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*즉시손절1*N4 and C > O Then ExitShort("s고점에서 내려와서 본전 청산",atlimit,EntryPrice-PriceScale*본전생각틱); } SetStopLoss(PriceScale*즉시손절1,PointStop); SetStopProfittarget(PriceScale*터치익절,PointStop);