커뮤니티

예스랭귀지 Q&A

글쓰기
답변완료

트레이딩뷰 수식 변경 요청드립니다.

안녕하세요. 트레이딩뷰 수식 변경 요청드립니다. 감사합니다~ //@version=5 indicator("Multi Kernel Regression [ChartPrime]", overlay = true, max_lines_count = 500, max_bars_back = 500, max_labels_count = 500) repaint = input.bool(true, "Repaint") kernel = input.string("Laplace", [ "Triangular" , "Gaussian" , "Epanechnikov" , "Logistic" , "Log Logistic" , "Cosine" , "Sinc" , "Laplace" , "Quartic" , "Parabolic" , "Exponential" , "Silverman" , "Cauchy" , "Tent" , "Wave" , "Power" , "Morters"]) bandwidth = input.int(14, 'Bandwidth', 1) source = input.source(close, 'Source') deviations = input.float(2.0, 'Deviation', 0, 100, 0.25, inline = "dev") style = input.string("Solid", "Line Style", ["Solid", "Dotted", "Dashed"]) enable = input.bool(false, "", inline = "dev") label_size = input.string("Tiny", "Labels", ["Auto", "Tiny", "Small", "Normal", "Large", "Huge"], inline = "label") lables = input.bool(true, "", inline = "label") bullish_color = input.color(color.rgb(84, 194, 148), "Colors", inline = "color") bearish_color = input.color(color.rgb(235, 57, 57), "", inline = "color") text_color = input.color(color.rgb(8, 12, 20), "", inline = "color") size = switch label_size "Auto" => size.auto "Tiny" => size.tiny "Small" => size.small "Normal" => size.normal "Large" => size.large "Huge" => size.huge line_style = switch style "Solid" => line.style_solid "Dotted" => line.style_dotted "Dashed" => line.style_dashed sq(source) => math.pow(source, 2) gaussian(source, bandwidth) => math.exp(-sq(source / bandwidth) / 2) / math.sqrt(2 * math.pi) triangular(source, bandwidth) => math.abs(source/bandwidth) <= 1 ? 1 - math.abs(source/bandwidth) : 0.0 epanechnikov(source, bandwidth) => math.abs(source/bandwidth) <= 1 ? (3/4.) * (1 - sq(source/bandwidth)) : 0.0 quartic(source, bandwidth) => if math.abs(source/bandwidth) <= 1 15/16. * math.pow(1 - sq(source/bandwidth), 2) else 0.0 logistic(source, bandwidth) => 1 / (math.exp(source / bandwidth) + 2 + math.exp(-source / bandwidth)) cosine(source, bandwidth) => math.abs(source/bandwidth) <= 1 ? (math.pi / 4) * math.cos((math.pi / 2) * (source/bandwidth)) : 0.0 laplace(source, bandwidth) => (1 / (2 * bandwidth)) * math.exp(-math.abs(source/bandwidth)) exponential(source, bandwidth) => (1 / bandwidth) * math.exp(-math.abs(source/bandwidth)) silverman(source, bandwidth) => if math.abs(source/bandwidth) <= 0.5 0.5 * math.exp(-(source/bandwidth)/2) * math.sin((source/bandwidth)/2 + math.pi/4) else 0.0 tent(source, bandwidth) => if math.abs(source/bandwidth) <= 1 1 - math.abs(source/bandwidth) else 0.0 cauchy(source, bandwidth) => 1 / (math.pi * bandwidth * (1 + sq(source / bandwidth))) sinc(source, bandwidth) => if source == 0 1 else math.sin(math.pi * source / bandwidth) / (math.pi * source / bandwidth) wave(source, bandwidth) => if (math.abs(source/bandwidth) <= 1) (1 - math.abs(source/bandwidth)) * math.cos((math.pi * source) / bandwidth) else 0.0 parabolic(source, bandwidth) => if math.abs(source/bandwidth) <= 1 1 - math.pow((source/bandwidth), 2) else 0.0 power(source, bandwidth) => if (math.abs(source/bandwidth) <= 1) math.pow(1 - math.pow(math.abs(source/bandwidth), 3), 3) else 0.0 loglogistic(source, bandwidth) => 1 / math.pow(1 + math.abs(source / bandwidth), 2) morters(source, bandwidth) => if math.abs(source / bandwidth) <= math.pi (1 + math.cos(source / bandwidth)) / (2 * math.pi * bandwidth) else 0.0 kernel(source, bandwidth, style)=> switch style "Triangular" => triangular(source, bandwidth) "Gaussian" => gaussian(source, bandwidth) "Epanechnikov" => epanechnikov(source, bandwidth) "Logistic" => logistic(source, bandwidth) "Log Logistic" => loglogistic(source, bandwidth) "Cosine" => cosine(source, bandwidth) "Sinc" => sinc(source, bandwidth) "Laplace" => laplace(source, bandwidth) "Quartic" => quartic(source, bandwidth) "Parabolic" => parabolic(source, bandwidth) "Exponential" => exponential(source, bandwidth) "Silverman" => silverman(source, bandwidth) "Cauchy" => cauchy(source, bandwidth) "Tent" => tent(source, bandwidth) "Wave" => wave(source, bandwidth) "Power" => power(source, bandwidth) "Morters" => morters(source, bandwidth) multi_kernel_regression(source, bandwidth, deviations, style, lables, enable, line_style, text_color, bullish_color, bearish_color, size, repaint)=> var estimate_array = array.new<line>(501, line.new(na, na, na, na)) var dev_upper_array = array.new<line>(501, line.new(na, na, na, na)) var dev_lower_array = array.new<line>(501, line.new(na, na, na, na)) var up_labels = array.new<label>(501, label.new(na, na)) var down_labels = array.new<label>(501, label.new(na, na)) float current_price = na float previous_price = na float previous_price_delta = na float std_dev = na float upper_1 = na float lower_1 = na float upper_2 = na float lower_2 = na line estimate = na line dev_upper = na line dev_lower = na label bullish = na label bearish = na if not repaint float sum = 0.0 float sumw = 0.0 float sumsq = 0.0 for i = 0 to bandwidth - 1 j = math.pow(i, 2) / (math.pow(bandwidth, 2)) weight = kernel(j, 1, style) sum += source[i] * weight sumw += weight mean = sum / sumw direction = mean - mean[1] > 0 direction_color = direction ? bullish_color : bearish_color for i = 0 to bandwidth - 1 sumsq += math.pow(source[i] - mean[i], 2) stdev = math.sqrt(sumsq / (bandwidth - 1)) * deviations array.unshift(estimate_array, line.new(bar_index, mean, bar_index - 1, mean[1], xloc.bar_index, extend.none, direction_color, line_style, 3)) if enable array.unshift(dev_upper_array, line.new(bar_index, mean + stdev, bar_index - 1, mean[1] + stdev[1], xloc.bar_index, extend.none, direction_color, line_style, 3)) array.unshift(dev_lower_array, line.new(bar_index, mean - stdev, bar_index - 1, mean[1] - stdev[1], xloc.bar_index, extend.none, direction_color, line_style, 3)) if lables if direction and not direction[1] array.unshift(up_labels, label.new(bar_index, source, "Up", yloc = yloc.belowbar, color = bullish_color, style = label.style_label_up, textcolor = text_color, size = size)) if not direction and direction[1] array.unshift(down_labels, label.new(bar_index, source, "Down", yloc = yloc.abovebar, color = bearish_color, style = label.style_label_down, textcolor = text_color, size = size)) else if barstate.isfirst for i = 500 to 0 array.set(estimate_array, i, line.new(na, na, na, na)) if enable array.set(dev_upper_array, i, line.new(na, na, na, na)) array.set(dev_lower_array, i, line.new(na, na, na, na)) if lables array.set(up_labels, i, label.new(na, na)) array.set(down_labels,i, label.new(na, na)) if barstate.islast for i = 0 to math.min(bar_index - 1, 500) float sum = 0 float sumw = 0 float sumsq = 0 for j = 0 to math.min(bar_index - 1, 500) diff = i - j weight = kernel(diff, bandwidth, kernel) sum += source[j] * weight sumsq += sq(source[j]) * weight sumw += weight current_price := sum / sumw delta = current_price - previous_price if enable std_dev := math.sqrt(math.max(sumsq / sumw - sq(current_price), 0)) upper_2 := current_price + deviations * std_dev lower_2 := current_price - deviations * std_dev estimate := array.get(estimate_array, i) if enable dev_upper := array.get(dev_upper_array, i) dev_lower := array.get(dev_lower_array, i) line.set_xy1(estimate, bar_index - i + 1, previous_price) line.set_xy2(estimate, bar_index - i, current_price) line.set_style(estimate, line_style) line.set_color(estimate, current_price > previous_price ? bearish_color : bullish_color) line.set_width(estimate, 3) if enable line.set_xy1(dev_upper, bar_index - i + 1, upper_1) line.set_xy2(dev_upper, bar_index - i , upper_2) line.set_style(dev_upper, line_style) line.set_color(dev_upper, current_price > previous_price ? bearish_color : bullish_color) line.set_width(dev_upper, 3) line.set_xy1(dev_lower, bar_index - i + 1, lower_1) line.set_xy2(dev_lower, bar_index - i , lower_2) line.set_style(dev_lower, line_style) line.set_color(dev_lower, current_price > previous_price ? bearish_color : bullish_color) line.set_width(dev_lower, 3) if lables bullish := array.get(up_labels, i) bearish := array.get(down_labels, i) if delta > 0 and previous_price_delta < 0 label.set_xy(bullish, bar_index - i + 1, source[i]) label.set_text(bullish, 'Up') label.set_color(bullish, bullish_color) label.set_textcolor(bullish, text_color) label.set_textalign(bullish, text.align_center) label.set_size(bullish, size) label.set_style(bullish, label.style_label_up) label.set_yloc(bullish, yloc.belowbar) if delta < 0 and previous_price_delta > 0 label.set_xy(bearish, bar_index - i + 1, source[i]) label.set_text(bearish, 'Down') label.set_textcolor(bearish, text_color) label.set_color(bearish, bearish_color) label.set_textalign(bearish, text.align_center) label.set_size(bearish, size) label.set_style(bearish, label.style_label_down) label.set_yloc(bearish, yloc.abovebar) previous_price := current_price upper_1 := upper_2 lower_1 := lower_2 previous_price_delta := delta if barstate.isconfirmed for i = array.size(up_labels) - 1 to 0 label.set_xy(array.get(up_labels, i), na, na) for i = array.size(down_labels) - 1 to 0 label.set_xy(array.get(down_labels, i), na, na) multi_kernel_regression(source, bandwidth, deviations, kernel, lables, enable, line_style, text_color, bullish_color, bearish_color, size, repaint)
프로필 이미지
jaylee
2024-01-18
1071
글번호 175884
사용자 함수
답변완료

시스템식 부탁드립니다.

안녕하세요 아래와 같이 코딩해 주셨는데 에러가 납니다. 다시한번 점검 부탁드립니다. 감사합니다. 1. 시스템식1 input : 매수매도(1);#매수1, 매도-1 input : 추가진입(20),최대누적진입(10),전체익절(20),최소수익(10),트레일링(5); var : BE(0),SE(0); var1 = (추가진입/PointValue)*PriceScale; Var2 = (전체익절/PointValue)*PriceScale; Var3 = (최소수익/PointValue)*PriceScale; Var4 = (트레일링/PointValue)*PriceScale; if MarketPosition == 0 and TotalTrades == TotalTrades[1] and 첫매수진입조건 Then Buy("b",OnClose,Def,1); if MarketPosition == 1 Then { if CurrentContracts > CurrentContracts[1] Then BE = BE+1; Buy("bb",AtLimit,EntryPrice(0)-(var1*BE),1); if MaxEntries == 1 and highest(H,BarsSinceEntry) >= EntryPrice+Var3 Then ExitLong("btr",AtStop,highest(H,BarsSinceEntry)-Var4); if MaxEntries >= 최대누적진입 Then { ExitLong("bx",AtStop,EntryPrice(0)-(var1*BE),"",1,1); } ExitLong("Bp",AtLimit,AvgEntryPrice+Var2); } Else BE = 0; if MarketPosition == 0 and TotalTrades == TotalTrades[1] and 첫매도진입조건 Then Sell("s",OnClose,Def,1); if MarketPosition == -1 Then { if CurrentContracts > CurrentContracts[1] Then SE = SE+1; Sell("ss",AtLimit,EntryPrice(0)+(var1*SE),1); if MaxEntries == 1 and lowest(L,BarsSinceEntry) <= EntryPrice-Var3 Then ExitShort("str",AtStop,lowest(L,BarsSinceEntry)+Var4); if MaxEntries >= 최대누적진입 Then { ExitShort("sx",AtStop,EntryPrice(0)+(var1*SE),"",1,1); } ExitShort("Sp",AtLimit,AvgEntryPrice-Var2); } Else SE = 0; 2. 시스템식2 10$ 정도 상승하면 마지막 진입한 계약만 익절 위 내용은 마지막진입가격에서 10$ 상승하면 1계약 익절청산으로 작성해 드립니다. 마지막 진입을 청산하기 위해서는 진입명을 지정해야 하는데 현재 하나의 함수로 추가진입이 됩니다. 해당 진입명을 지정하면 해당 진입으로 들어간 모든 추가진입이 청산됩니다, 내용상 각 추가진입별로 이름을 부여하기 어려워 1계약 청산으로 작성해 드립니다. input : 매수매도(1);#매수1, 매도-1 input : 추가진입(20),최대누적진입(10),전체익절(20),최소수익(10),트레일링(5),익절(10); var : BE(0),SE(0),S(0); var1 = (추가진입/PointValue)*PriceScale; Var2 = (전체익절/PointValue)*PriceScale; Var3 = (최소수익/PointValue)*PriceScale; Var4 = (트레일링/PointValue)*PriceScale; Var5 = (익절/PointValue)*PriceScale; if MarketPosition == 0 and TotalTrades == TotalTrades[1] and 첫매수진입조건 Then Buy("b",OnClose,Def,1); if MarketPosition == 1 Then { if CurrentContracts > CurrentContracts[1] Then { S = 1; BE = LatestEntryPrice(0); } if CurrentContracts < CurrentContracts[1] Then { S = -1; BE = LatestExitPrice(0); } Buy("bb",AtLimit,BE-var1,1); if MaxEntries == 1 and highest(H,BarsSinceEntry) >= EntryPrice+Var3 Then ExitLong("btr",AtStop,highest(H,BarsSinceEntry)-Var4); if S == 1 and MaxEntries >= 2 Then ExitLong("bp1",AtLimit,BE+Var5,"",1,1); ExitLong("Bp",AtLimit,AvgEntryPrice+Var2); } if MarketPosition == 0 and TotalTrades == TotalTrades[1] and 첫매도진입조건 Then Sell("s",OnClose,Def,1); if MarketPosition == 1 Then { if CurrentContracts > CurrentContracts[1] Then { S = 1; SE = LatestEntryPrice(0); } if CurrentContracts < CurrentContracts[1] Then { S = -1; SE = LatestExitPrice(0); } Sell("ss",AtLimit,SE+var1,1); if MaxEntries == 1 and lowest(L,BarsSinceEntry) <= EntryPrice-Var3 Then ExitShort("str",AtStop,lowest(L,BarsSinceEntry)+Var4); if S == 1 and MaxEntries >= 2 Then ExitShort("sp1",AtLimit,BE-var5,"",1,1); ExitShort("Sp",AtLimit,AvgEntryPrice-Var2); }
프로필 이미지
양치기
2024-01-18
759
글번호 175882
시스템
답변완료

함수요청

안녕하세요? 아래 글번호 85413번 재질문입니다. 당일 개장 후 5개 봉의 장중 고점(var1)과 저점(var2)으로 하여 85413번에서 작성 주신 스크립트를 수정 부탁드립니다. 감사합니다.
프로필 이미지
흰둥이아빠
2024-01-18
674
글번호 175881
시스템
답변완료

문의 드립니다

안녕하세요 신호문의 입니다 수정문의입니다 매수 신호: 앞 캔들이 양,음봉 상관없이 다음 캔들의 몸통의 중심이 앞캔들의 저가보다 클 때,양봉 저가에 수평선 표시 매도 신호: 앞갠들이 양,음봉 상관없이 다음 음봉 캔들의 몸통의 중심이 앞 캔들의 고 가보다 작을때,음봉 고가에 수평선 표시 10틱씩 수익이 발생할때마다 텍스트 출력할수 있으면 합니다 부탁드립니다 감사합니다
프로필 이미지
만강
2024-01-18
623
글번호 175879
시스템

nicebs 님에 의해서 삭제되었습니다.

프로필 이미지
nicebs
2024-01-18
26
글번호 175869
종목검색
답변완료

종목검색식좀 부탁드립니다

안녕하세요 항상감사드립니다. 키움신호수식 a=sum(v* ((Pow((C-L),2) - Pow((H-C),2)) / (H-L)) ); b=shift(sum(v* ((Pow((C-L),2) - Pow((H-C),2)) / (H-L)) ),aa); crossup(a,b) aa값은 30 일봉상 돌파하는 종목을 검색하고싶습니다, 수식변환좀 부탁드립니다 감사합니다
프로필 이미지
mizno
2024-01-18
683
글번호 175868
종목검색
답변완료

수정 부탁드립니다.

안녕하세요? 아래의 수식에서 현재 매매횟수가 잘 안맞습니다. 외부변수에 지정해놓은 매매횟수보다 1회씩 더 나오는날이 많이 나오는 현상입니다. 정해놓은 횟수로 거래가 진행되었으면 합니다. 감사합니다. inputs: Length(10), Pval(0.05),당일청산(153000); input : 익절틱수(10), 손절틱수(10), 진입횟수(3); var : entry(0); if Bdate != Bdate[1] Then entry = 0; if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or (MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then entry = entry+1; if MarketPosition == 0 and entry < 진입횟수 then Sell("S", AtStop, Lowest(Low, Length) - Pval) ; if MarketPosition == 0 and entry < 진입횟수 then Buy("B", AtStop, highest(high, Length) + Pval) ; SetStopProfittarget(PriceScale*익절틱수,PointStop); SetStopLoss(PriceScale*손절틱수,PointStop); SetStopEndofday(당일청산);
프로필 이미지
대구어린울프
2024-01-18
627
글번호 175867
시스템
답변완료

수식문의합니다.

안녕하세요. 1. 날짜가 바뀐 후 5분봉 누적 거래량이 1봉전 누적거래량 대비 200% 이상인 종목 2. 당일 고점이 전일 종가 대비 15% 이상, 거래대금 100억 이상인 종목 3. 2번 조건을 만족한 후 당일 고점대비 6% 하락선을 저가 터치한 종목 4. 3번 조건을 만족한 후 당일 고점대비 6% 하락선을 종가 돌파한 종목 5. 2번 조건 만족 후 n봉 이내에(초기값:10) 전일종가 대비 15% 상승선을 저가 터치한 종목 감사합니다.
프로필 이미지
트더
2024-01-18
676
글번호 175865
종목검색
답변완료

문의 드립니다

안녕하세요 1. 당일 obv X=sum(if(c>c(1), v, if(c<c(1), -v, 0))); Y=valueWhen(1, date!=date(1), X(1)); Z=X-Y; 2. 전일 obv X=sum(if(c>c(1), v, if(c<c(1), -v, 0))); Y=valuewhen(1,date(1)!=date,X(1)); Z=X-Y; A=valuewhen(1,date(1)!=date,Z(1)); 3. 1.2. 수식은 obv 누적 거래량 수식으로 전일 누적 거래량 상향 돌파와 하향돌파 검색식 부탁드립니다 수고하세요
프로필 이미지
힘찬하루
2024-01-18
737
글번호 175863
종목검색
답변완료

문의 드립니다

안녕하세요 1.캔들의 각봉 몸통의 중심을 연결하는 선을 만들고자 합니다 캔들의 고저 중심을 연결하는 선을 만들고자 합니다 3. 시스템 문의 입니다 1) 매수 신호: 앞 캔들 고가을 완성봉이 돌파시, 그리고 돌파봉 저가에 수평선 표시 매도 신호: 앞 캔들 저가을 완성봉이 돌파시, 그리고 돌파봉 고가에 수평선 표시 10틱씩 수익이 발생할때마다 텍스트 출력할수 있으면 합니다 2)매수 신호: 앞 캔들이 음봉이며 다음 캔들의 몸통의 중심이 앞캔들의 저가보다 클 때,양봉 저가에 수평선 표시 매도 신호: 앞갠들이 양봉이며 다음 음봉 캔들의 몸통의 중심이 앞 양봉캔들의 고 가보다 작을때,음봉 고가에 수평선 표시 10틱씩 수익이 발생할때마다 텍스트 출력할수 있으면 합니다 부탁드립니다 감사합니다
프로필 이미지
만강
2024-01-18
829
글번호 175854
지표