커뮤니티

특정 지정 거래 발생후 당일 거래 제한 수식 추가건

프로필 이미지
이형지
2020-01-16 23:22:01
120
글번호 135210
답변완료
익절 청산시에는 당일 추가 거래가 되고 손절발생시 당일 거래 안하고 그다음날부터 거래가되는 수식입니다. 그런데 문제가 생겼네요.. 부가적으로 어느정도 수익중에 있다가 진입가 근처에 도달시 "본절청산1"이라는 청산이름으로 정했고 해당 매매 발생시에도 손실청산 과 같이 당일 거래가 제한되게 하는 식을 부가적으로 부탁드리겠습니다. ====================================== 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"); if highest(H,BarsSinceEntry) >= (EntryPrice+PriceScale*즉시익절1*N2) Then ExitLong("본전청산1",AtStop,EntryPrice+PriceScale*즉시익절1*N3); Else ExitLong("즉시손절1",AtStop,EntryPrice-PriceScale*즉시손절1); }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2020-01-17 09:02:06

안녕하세요 예스스탁입니다. 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 or IsExitName("본전청산1",1)) 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"); if highest(H,BarsSinceEntry) >= (EntryPrice+PriceScale*즉시익절1*N2) Then ExitLong("본전청산1",AtStop,EntryPrice+PriceScale*즉시익절1*N3); Else ExitLong("즉시손절1",AtStop,EntryPrice-PriceScale*즉시손절1); } 즐거운 하루되세요 > 이형지 님이 쓴 글입니다. > 제목 : 특정 지정 거래 발생후 당일 거래 제한 수식 추가건 > 익절 청산시에는 당일 추가 거래가 되고 손절발생시 당일 거래 안하고 그다음날부터 거래가되는 수식입니다. 그런데 문제가 생겼네요.. 부가적으로 어느정도 수익중에 있다가 진입가 근처에 도달시 "본절청산1"이라는 청산이름으로 정했고 해당 매매 발생시에도 손실청산 과 같이 당일 거래가 제한되게 하는 식을 부가적으로 부탁드리겠습니다. ====================================== 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"); if highest(H,BarsSinceEntry) >= (EntryPrice+PriceScale*즉시익절1*N2) Then ExitLong("본전청산1",AtStop,EntryPrice+PriceScale*즉시익절1*N3); Else ExitLong("즉시손절1",AtStop,EntryPrice-PriceScale*즉시손절1); }