커뮤니티

RSI 일봉 조건을 data2 버전으로 하지말고 하나의 차트에서 할수 있는 수식 부탁드려요

프로필 이미지
이형지
2020-01-12 20:29:38
231
글번호 135079
답변완료
아래 수식은 일봉 RSI 값 반영하는 수식인데요 해당 수식을 data2 를 사용하지 않고 하나틔 차트에서 구현할수 있도록 부탁드릴께요~~ Input : RSIPeriod(14),RSI매수값(22),SimPeriod(14),심리도값(22); Input : N1(1),초기화(7); Input : CCI기간(50),CCI값(450); Input : 하락틱수(20); Input : 즉시익절1(150),즉시손절1(150); Input : 분할매수횟수(2),분할매수틱수(100); Input : RSIPeriod1(20),A(35); var:RSIVV(0,data2); var : CCIv(0),RSIv(0),Simri(0),BuySetup(false),DD(0),entry(0); CCIv = CCI(CCI기간); RSIV = RSI(RSIPeriod); Simri = Simrido(SimPeriod); RSIVV = RSI(RSIPeriod1); 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 then Condition2 = false; Condition1 = RSIv < RSI매수값 and Simri < 심리도값; 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 BuySetup == true and data2(RSIVV > A) Then buy("매수",AtLimit,var1-PriceScale*하락틱수);
시스템
답변 3
프로필 이미지

예스스탁 예스스탁 답변

2020-01-13 13:51:45

안녕하세요 예스스탁입니다. Input : RSIPeriod(14),RSI매수값(22),SimPeriod(14),심리도값(22); Input : N1(1),초기화(7); Input : CCI기간(50),CCI값(450); Input : 하락틱수(20); Input : 즉시익절1(150),즉시손절1(150); Input : 분할매수횟수(2),분할매수틱수(100); Input : RSIPeriod1(20),A(35); 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); 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 then Condition2 = false; Condition1 = RSIv < RSI매수값 and Simri < 심리도값; 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 BuySetup == true and RSIVV > A Then buy("매수",AtLimit,var1-PriceScale*하락틱수); 즐거운 하루되세요 > 이형지 님이 쓴 글입니다. > 제목 : RSI 일봉 조건을 data2 버전으로 하지말고 하나의 차트에서 할수 있는 수식 부탁드려?
프로필 이미지

이형지

2020-01-13 16:40:32

data1는 60분봉 data2는 일봉으로 셋팅 Input : RSIPeriod(14),RSI매수값(50),SimPeriod(14),심리도값(22); Input : N1(1),초기화(7); Input : CCI기간(20),CCI값(400); Input : 하락틱수(30); Input : 즉시익절1(110),즉시손절1(80); Input : 분할매수횟수(2),분할매수틱수(45); Input : RSIPeriod1(20),A(35); var:RSIVV(0,data2); var : CCIv(0),RSIv(0),Simri(0),BuySetup(false),DD(0),entry(0); CCIv = CCI(CCI기간); RSIV = RSI(RSIPeriod); Simri = Simrido(SimPeriod); RSIVV = RSI(RSIPeriod1); 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 then Condition2 = false; Condition1 = RSIv < RSI매수값 and Simri < 심리도값; 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 BuySetup == true and data2(RSIVV > A) Then buy("매수",AtLimit,var1-PriceScale*하락틱수); #추가진입 if MarketPosition == 1 and MaxEntries < 분할매수횟수 Then buy("추가매수",atlimit,LatestEntryPrice(0)-PriceScale*분할매수틱수,1); if MarketPosition == 1 then { BuySetup = false; if countif(CrossDown(CCIv,CCI값),BarsSinceEntry) >= 1 and CCIv < CCI값 and C < O Then ExitLong("매수cci청산"); if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*즉시익절1 and C < O Then ExitLong("즉시익절1"); ExitLong("즉시손절1",AtStop,EntryPrice-PriceScale*즉시손절1); } =============================================================== 아래 수식은 과장님이 알려주신식을 대입한것인데... 결과값이 다르게 나와서요.... 혹시 뭐가 잘못되는지 알려주시면 감사하겠습니다. * 원하는 수식은 data2 차트를 화용하지 않고 일봉 RSI값을 반영하는것입니다. Input : RSIPeriod(14),RSI매수값(50),SimPeriod(14),심리도값(22); Input : N1(1),초기화(7); Input : CCI기간(20),CCI값(400); Input : 하락틱수(30); Input : 즉시익절1(110),즉시손절1(80); Input : 분할매수횟수(2),분할매수틱수(45); Input : RSIPeriod1(20),A(35); 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); 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 then Condition2 = false; Condition1 = RSIv < RSI매수값 and Simri < 심리도값; 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 BuySetup == true and RSIVV > A Then buy("매수",AtLimit,var1-PriceScale*하락틱수); #추가진입 if MarketPosition == 1 and MaxEntries < 분할매수횟수 Then buy("추가매수",atlimit,LatestEntryPrice(0)-PriceScale*분할매수틱수,1); if MarketPosition == 1 then { BuySetup = false; if countif(CrossDown(CCIv,CCI값),BarsSinceEntry) >= 1 and CCIv < CCI값 and C < O Then ExitLong("매수cci청산"); if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*즉시익절1 and C < O Then ExitLong("즉시익절1"); ExitLong("즉시손절1",AtStop,EntryPrice-PriceScale*즉시손절1); }
프로필 이미지

예스스탁 예스스탁 답변

2020-01-13 17:40:34

안녕하세요 예스스탁입니다. 1 RSI가 과거봉수에 따라 값이 변경이 있는 지표입니다. 전략실행차트가 최대 1만개봉이 조회되므로 최대한 많은 봉을 조회해서 적용하셔야 일봉차트에서 보는 RSI와 근접하게 됩니다. 2 var:RSIVV(0,data2); RSIVV = RSI(RSIPeriod1); data2(RSIVV > A) 기존에 작성하신식에서 RSIVV는 위와 같은 구조로 작성이 되어 있습니다. 이는 일봉데이타에서 계산한 RSI값이 아닙니다. 분봉에서 RSI를 계산한 값입니다. 변수에 값자체를 data1로 계산한 값을 저장하고 해당 변수를 data2로 씌우는 것은 의미가 없습니다. data2의 RSI라면 아래와 같이 작성이 되어 있어야 합니다. var:RSIVV(0,data2); RSIVV = data2(RSI(RSIPeriod1)); RSIVV > A 3 차트에서 데이타는 완성봉의 데이타만 사용하게 됩니다. var:RSIVV(0,data2); RSIVV = data2(RSI(RSIPeriod1)); RSIVV > A 위와 같이 작성해서 일봉의 RSI를 계산하면 RSIVV > A는 일봉의 최근 완성봉은 전일봉이므로 전일 일봉의 RSI가 A보다 크다라는 조건입니다. 참조데이타가 일봉이면 당일의 값을 포함하지 못하므로 분봉차트에서 일봉지표값을 직접 계산해서 사용하게 됩니다. 즐거운 하루되세요 > 이형지 님이 쓴 글입니다. > 제목 : Re : Re : RSI 일봉 조건을 data2 버전으로 하지말고 하나의 차트에서 할수 있는 수식