커뮤니티

변환 부탁드립니다.

프로필 이미지
다올
2025-09-04 19:31:25.0
109
글번호 193735
답변완료
트레이딩뷰 수식입니다. 변환 부탁 드립니다. //@version=6 strategy("Triangular Hull Moving Average [BigBeluga X PineIndicators]", "THMA [BigBeluga X PineIndicators]", overlay = true, commission_value = 0.01, slippage = 2, initial_capital = 1000, margin_long = 0, margin_short = 0, default_qty_value = 1) // INPUTS int len_ = input.int(40, "Length") float source = input.source(close, "Source") bool volat = input.bool(true, "Volatility", inline = "vola"), len_vol = input.int(15, "", inline = "vola") color_u = input.color(#16e5a0, "", inline = "colors") color_d = input.color(#741ddd, "", inline = "colors") // Neue Option: Entry Direction Auswahl entry_mode = input.string("Long & Short", "Trade Direction", options = ["Only Long", "Only Short", "Long & Short"]) // CALCULATIONS float volatility = ta.hma(high - low, len_vol) var string trend = "" vv = ta.percentile_nearest_rank(volatility, 1000, 100) vol = volatility / vv // THMA-Funktion thma(_src, _length) => ta.wma(ta.wma(_src, _length / 3) * 3 - ta.wma(_src, _length / 2) - ta.wma(_src, _length), _length) float thma = thma(source, len_) float thma1 = thma[2] bool signal_up = ta.crossover(thma, thma1) bool signal_dn = ta.crossunder(thma, thma1) switch signal_up => trend := "🢁" signal_dn => trend := "🢃" color = thma > thma1 ? color_u : color_d color1 = color atr = ta.atr(200) // PLOT plotcandle(thma, thma + volatility, thma1 - volatility, thma1, "", color.new(color1, volat ? 40 : 0), color.new(color1, volat ? 40 : 100), bordercolor = color.new(color1,0)) plotshape(signal_up ? thma1 - atr : na, "Up", shape.triangleup, location.absolute, color = color.new(color, 60), size = size.small, force_overlay = true) plotshape(signal_up ? thma1 - atr : na, "Up", shape.triangleup, location.absolute, color = color.new(color, 0), size = size.tiny, force_overlay = true) plotshape(signal_dn ? thma1 + atr : na, "Dn", shape.triangledown, location.absolute, color = color.new(color, 60), size = size.small, force_overlay = true) plotshape(signal_dn ? thma1 + atr : na, "Dn", shape.triangledown, location.absolute, color = color.new(color, 0), size = size.tiny, force_overlay = true) if barstate.islast dash = table.new(position.bottom_right, 10, 10, bgcolor = color.new(chart.fg_color, 90), border_color = chart.bg_color, border_width = 5) dash.cell(0, 0, "Trend: " + trend, text_color = trend == "🢃" ? color_d : color_u) dash.cell(0, 1, "Volatility: " + str.tostring(vol * 100, format.percent), text_color = chart.fg_color) // Entry- und Close-Logik bool allow_long = entry_mode == "Only Long" or entry_mode == "Long & Short" bool allow_short = entry_mode == "Only Short" or entry_mode == "Long & Short" // Long & Short-Modus: Positions eröffnen if signal_up and allow_long strategy.entry("Long", strategy.long) if signal_dn and allow_short strategy.entry("Short", strategy.short) // Spezielle Schließlogik für "Only Long" und "Only Short" if entry_mode == "Only Long" // Bei Short-Signal bestehende Long-Position schließen if signal_dn strategy.close("Long") if entry_mode == "Only Short" // Bei Long-Signal bestehende Short-Position schließen if signal_up strategy.close("Short")
지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2025-09-08 10:47:50.0

안녕하세요 예스스탁입니다. 강조식으로 작성해 드립니다. 신호는 텍스트로 추가해 드립니다. input : len_(40); input : volat(true); input : len_vol(15); input : color_u(Lime); input : color_d(Violet); var : source(0); var : trend(""),vv(0),i(0),k(0),vol(0),thma(0),thma1(0); Array : volatility[1000](Nan),SR[1000](Nan); var : signal_up(False),signal_dn(False),tx(0); source = close; For i = 999 Downto 1 { volatility[i] = volatility[i-1]; } volatility[0] = wma(2 * wma(high - low, len_vol / 2) - wma(high - low, len_vol), round(sqrt(len_vol),0)); vv = PercentileArray(1,volatility, 1000); vol = volatility[0]/ vv; thma = wma(wma(source, len_ / 3) * 3 - wma(source, len_ / 2) - wma(source, len_), len_); thma1 = thma[2]; PlotPaintBar(thma+volatility[0],thma-volatility[0],"강조",iff(thma > thma1 , color_u , color_d)); signal_up = CrossUp(thma, thma1); signal_dn = CrossDown(thma, thma1); if signal_up == true Then { tx = Text_New(sDate,sTime,thma-volatility[0],"▲"); Text_SetStyle(tx,2,0); Text_SetColor(tx,Red); } if signal_dn == true Then { tx = Text_New(sDate,sTime,thma+volatility[0],"▼"); Text_SetStyle(tx,2,1); Text_SetColor(tx,Blue); } 즐거운 하루되세요 > 다올 님이 쓴 글입니다. > 제목 : 변환 부탁드립니다. > 트레이딩뷰 수식입니다. 변환 부탁 드립니다. //@version=6 strategy("Triangular Hull Moving Average [BigBeluga X PineIndicators]", "THMA [BigBeluga X PineIndicators]", overlay = true, commission_value = 0.01, slippage = 2, initial_capital = 1000, margin_long = 0, margin_short = 0, default_qty_value = 1) // INPUTS int len_ = input.int(40, "Length") float source = input.source(close, "Source") bool volat = input.bool(true, "Volatility", inline = "vola"), len_vol = input.int(15, "", inline = "vola") color_u = input.color(#16e5a0, "", inline = "colors") color_d = input.color(#741ddd, "", inline = "colors") // Neue Option: Entry Direction Auswahl entry_mode = input.string("Long & Short", "Trade Direction", options = ["Only Long", "Only Short", "Long & Short"]) // CALCULATIONS float volatility = ta.hma(high - low, len_vol) var string trend = "" vv = ta.percentile_nearest_rank(volatility, 1000, 100) vol = volatility / vv // THMA-Funktion thma(_src, _length) => ta.wma(ta.wma(_src, _length / 3) * 3 - ta.wma(_src, _length / 2) - ta.wma(_src, _length), _length) float thma = thma(source, len_) float thma1 = thma[2] bool signal_up = ta.crossover(thma, thma1) bool signal_dn = ta.crossunder(thma, thma1) switch signal_up => trend := "🢁" signal_dn => trend := "🢃" color = thma > thma1 ? color_u : color_d color1 = color atr = ta.atr(200) // PLOT plotcandle(thma, thma + volatility, thma1 - volatility, thma1, "", color.new(color1, volat ? 40 : 0), color.new(color1, volat ? 40 : 100), bordercolor = color.new(color1,0)) plotshape(signal_up ? thma1 - atr : na, "Up", shape.triangleup, location.absolute, color = color.new(color, 60), size = size.small, force_overlay = true) plotshape(signal_up ? thma1 - atr : na, "Up", shape.triangleup, location.absolute, color = color.new(color, 0), size = size.tiny, force_overlay = true) plotshape(signal_dn ? thma1 + atr : na, "Dn", shape.triangledown, location.absolute, color = color.new(color, 60), size = size.small, force_overlay = true) plotshape(signal_dn ? thma1 + atr : na, "Dn", shape.triangledown, location.absolute, color = color.new(color, 0), size = size.tiny, force_overlay = true) if barstate.islast dash = table.new(position.bottom_right, 10, 10, bgcolor = color.new(chart.fg_color, 90), border_color = chart.bg_color, border_width = 5) dash.cell(0, 0, "Trend: " + trend, text_color = trend == "🢃" ? color_d : color_u) dash.cell(0, 1, "Volatility: " + str.tostring(vol * 100, format.percent), text_color = chart.fg_color) // Entry- und Close-Logik bool allow_long = entry_mode == "Only Long" or entry_mode == "Long & Short" bool allow_short = entry_mode == "Only Short" or entry_mode == "Long & Short" // Long & Short-Modus: Positions eröffnen if signal_up and allow_long strategy.entry("Long", strategy.long) if signal_dn and allow_short strategy.entry("Short", strategy.short) // Spezielle Schließlogik für "Only Long" und "Only Short" if entry_mode == "Only Long" // Bei Short-Signal bestehende Long-Position schließen if signal_dn strategy.close("Long") if entry_mode == "Only Short" // Bei Long-Signal bestehende Short-Position schließen if signal_up strategy.close("Short")