답변완료
지표 변환 부탁드립니다.
//@version=6
indicator("Trend Classifier [ChartPrime]", overlay = true, max_labels_count = 500)
// --------------------------------------------------------------------------------------------------------------------}
// 📌 𝙐𝙎𝙀𝙍 𝙄𝙉𝙋𝙐𝙏𝙎
// --------------------------------------------------------------------------------------------------------------------{
int length = input.int(10, "Length")
bool show_bands = input.bool(true, "Trend Bands")
color col_up = input.color(#008fa5, "", inline = "col")
color col_dn = input.color(#e14c60, "", inline = "col")
color col_range = input.color(#edae49, "", inline = "col")
// --------------------------------------------------------------------------------------------------------------------}
// 📌 𝙄𝙉𝘿𝙄𝘾𝘼𝙏𝙊𝙍 𝘾𝘼𝙇𝘾𝙐𝙇𝘼𝙏𝙄𝙊𝙉𝙎
// --------------------------------------------------------------------------------------------------------------------{
smema(src, length)=>
ta.sma(ta.ema(src, length), length)
col_distance(src, col)=>
distance = math.abs(close - src)
col_size = distance / ta.percentile_linear_interpolation(distance, 400, 100)
show_bands ? color.from_gradient(col_size, 0, 0.5, color(na), col) : color(na)
float smema = smema(close, length)
float distance1 = close - smema
float distance2 = smema - close
float step = smema(high-low, 100)
float smema_up3 = smema + step * 3
float smema_up2 = smema + step * 2
float smema_up1 = smema + step
float smema_dn3 = smema - step * 3
float smema_dn2 = smema - step * 2
float smema_dn1 = smema - step
bool trend = smema > smema[1]
bool above3 = close > smema_up3
bool above2 = close > smema_up2
bool above1 = close > smema_up1
bool below1 = close < smema_dn1
bool below2 = close < smema_dn2
bool below3 = close < smema_dn3
int bull_strength = (above1 ? 1 : 0) + (above2 ? 1 : 0) + (above3 ? 1 : 0)
int bear_strength = (below1 ? 1 : 0) + (below2 ? 1 : 0) + (below3 ? 1 : 0)
label_signal =
trend and bull_strength >= 1 ? 1 :
not trend and bear_strength >= 1 ? -1 : 0
// --------------------------------------------------------------------------------------------------------------------}
// 📌 𝙑𝙄𝙎𝙐𝘼𝙇𝙄𝙕𝘼𝙏𝙄𝙊𝙉
// --------------------------------------------------------------------------------------------------------------------{
table mytbl = table.new(position.top_right, 10, 50)
if barstate.islast
table.cell(mytbl, 0, 0, "Bull Strength", text_color = chart.fg_color)
table.cell(mytbl, 0, 1, "Bear Strength", text_color = chart.fg_color)
for i = 0 to 3
table.cell(mytbl, 1+i, 0, "")
if bull_strength >= 0
for i = 0 to bull_strength
table.cell(mytbl, i+1, 0, i == bull_strength ? str.tostring(bull_strength) : "", bgcolor = color.new(col_up, 80 - i * 30), text_color = chart.fg_color)
if bear_strength >= 0
for i = 0 to bear_strength
table.cell(mytbl, i+1, 1, i == bear_strength ? str.tostring(bear_strength) : "", bgcolor = color.new(col_dn, 80 - i * 30), text_color = chart.fg_color)
color color_class = label_signal > 0 ? col_up : label_signal < 0 ? col_dn : col_range
// Labels
barcolor(color_class)
plotcandle(open, high, low, close, title='Candles Color', color = color_class, wickcolor=color_class, bordercolor = color_class, force_overlay = true)
plotshape(trend != trend[1] ? smema[1] : na, location=location.absolute, color=chart.fg_color, style=shape.diamond, title="Trend Signal", force_overlay = true, offset = -1, size = size.tiny)
if label_signal == 1
label.new(bar_index, low, "▲₩n" + str.tostring(bull_strength), style = label.style_label_up, color = color(na), size = size.tiny, textcolor = color_class)
if label_signal == -1
label.new(bar_index, high, str.tostring(bear_strength) + "₩n▼", style = label.style_label_down, color = color(na), size = size.tiny, textcolor = color_class)
color col_mid = smema > smema[1] ? col_up : col_dn
color col_up1 = col_distance(smema_up1, close > smema_up1 and trend ? col_up : close < smema_up1 and not trend ? col_dn : color(na))
color col_up2 = col_distance(smema_up2, close > smema_up2 and trend ? col_up : close < smema_up2 and not trend ? col_dn : color(na))
color col_up3 = col_distance(smema_up3, close > smema_up3 and trend ? col_up : close < smema_up3 and not trend ? col_dn : color(na))
color col_dn1 = col_distance(smema_dn1, close < smema_dn1 and not trend ? col_dn : close > smema_dn1 and trend ? col_up : color(na))
color col_dn2 = col_distance(smema_dn2, close < smema_dn2 and not trend ? col_dn : close > smema_dn2 and trend ? col_up : color(na))
color col_dn3 = col_distance(smema_dn3, close < smema_dn3 and not trend ? col_dn : close > smema_dn3 and trend ? col_up : color(na))
plot(smema_up3, color = col_up3, editable = false)
plot(smema_up2, color = col_up2, editable = false)
plot(smema_up1, color = col_up1, editable = false)
plot(smema, "Trend Line",color = col_mid, editable = true, linewidth = 2)
plot(smema_dn1, color = col_dn1, editable = false)
plot(smema_dn2, color = col_dn2, editable = false)
plot(smema_dn3, color = col_dn3, editable = false)
// --------------------------------------------------------------------------------------------------------------------}
2025-05-14
283
글번호 190801
지표
답변완료
문의드립니다.
아래의 트레이딩뷰 수식을 변환부탁드립니다.
=============
indicator(title="Volume Weighted Average Price", shorttitle="VWAP", overlay=true, timeframe="", timeframe_gaps=true)
hideonDWM = input(false, title="Hide VWAP on 1D or Above", group="VWAP Settings", display = display.data_window)
var anchor = input.string(defval = "Session", title="Anchor Period",
options=["Session", "Week", "Month", "Quarter", "Year", "Decade", "Century", "Earnings", "Dividends", "Splits"], group="VWAP Settings")
src = input(title = "Source", defval = hlc3, group="VWAP Settings", display = display.data_window)
offset = input.int(0, title="Offset", group="VWAP Settings", minval=0, display = display.data_window)
BANDS_GROUP = "Bands Settings"
CALC_MODE_TOOLTIP = "Determines the units used to calculate the distance of the bands. "
calcModeInput = input.string("Standard Deviation", "Bands Calculation Mode", options = ["Standard Deviation", "Percentage"], group = BANDS_GROUP, tooltip = CALC_MODE_TOOLTIP, display = display.data_window)
showBand_1 = input(true, title = "", group = BANDS_GROUP, inline = "band_1", display = display.data_window)
bandMult_1 = input.float(1.0, title = "Bands Multiplier #1", group = BANDS_GROUP, inline = "band_1", step = 0.5, minval=0, display = display.data_window)
showBand_2 = input(false, title = "", group = BANDS_GROUP, inline = "band_2", display = display.data_window)
bandMult_2 = input.float(2.0, title = "Bands Multiplier #2", group = BANDS_GROUP, inline = "band_2", step = 0.5, minval=0, display = display.data_window)
showBand_3 = input(false, title = "", group = BANDS_GROUP, inline = "band_3", display = display.data_window)
bandMult_3 = input.float(3.0, title = "Bands Multiplier #3", group = BANDS_GROUP, inline = "band_3", step = 0.5, minval=0, display = display.data_window)
cumVolume = ta.cum(volume)
if barstate.islast and cumVolume == 0
runtime.error("No volume is provided by the data vendor.")
new_earnings = request.earnings(syminfo.tickerid, earnings.actual, barmerge.gaps_on, barmerge.lookahead_on, ignore_invalid_symbol=true)
new_dividends = request.dividends(syminfo.tickerid, dividends.gross, barmerge.gaps_on, barmerge.lookahead_on, ignore_invalid_symbol=true)
new_split = request.splits(syminfo.tickerid, splits.denominator, barmerge.gaps_on, barmerge.lookahead_on, ignore_invalid_symbol=true)
isNewPeriod = switch anchor
"Earnings" => not na(new_earnings)
"Dividends" => not na(new_dividends)
"Splits" => not na(new_split)
"Session" => timeframe.change("D")
"Week" => timeframe.change("W")
"Month" => timeframe.change("M")
"Quarter" => timeframe.change("3M")
"Year" => timeframe.change("12M")
"Decade" => timeframe.change("12M") and year % 10 == 0
"Century" => timeframe.change("12M") and year % 100 == 0
=> false
isEsdAnchor = anchor == "Earnings" or anchor == "Dividends" or anchor == "Splits"
if na(src[1]) and not isEsdAnchor
isNewPeriod := true
float vwapValue = na
float upperBandValue1 = na
float lowerBandValue1 = na
float upperBandValue2 = na
float lowerBandValue2 = na
float upperBandValue3 = na
float lowerBandValue3 = na
if not (hideonDWM and timeframe.isdwm)
[_vwap, _stdevUpper, _] = ta.vwap(src, isNewPeriod, 1)
vwapValue := _vwap
stdevAbs = _stdevUpper - _vwap
bandBasis = calcModeInput == "Standard Deviation" ? stdevAbs : _vwap * 0.01
upperBandValue1 := _vwap + bandBasis * bandMult_1
lowerBandValue1 := _vwap - bandBasis * bandMult_1
upperBandValue2 := _vwap + bandBasis * bandMult_2
lowerBandValue2 := _vwap - bandBasis * bandMult_2
upperBandValue3 := _vwap + bandBasis * bandMult_3
lowerBandValue3 := _vwap - bandBasis * bandMult_3
plot(vwapValue, title = "VWAP", color = #2962FF, offset = offset)
upperBand_1 = plot(upperBandValue1, title="Upper Band #1", color = color.green, offset = offset, display = showBand_1 ? display.all : display.none, editable = showBand_1)
lowerBand_1 = plot(lowerBandValue1, title="Lower Band #1", color = color.green, offset = offset, display = showBand_1 ? display.all : display.none, editable = showBand_1)
fill(upperBand_1, lowerBand_1, title="Bands Fill #1", color = color.new(color.green, 95), display = showBand_1 ? display.all : display.none, editable = showBand_1)
upperBand_2 = plot(upperBandValue2, title="Upper Band #2", color = color.olive, offset = offset, display = showBand_2 ? display.all : display.none, editable = showBand_2)
lowerBand_2 = plot(lowerBandValue2, title="Lower Band #2", color = color.olive, offset = offset, display = showBand_2 ? display.all : display.none, editable = showBand_2)
fill(upperBand_2, lowerBand_2, title="Bands Fill #2", color = color.new(color.olive, 95), display = showBand_2 ? display.all : display.none, editable = showBand_2)
upperBand_3 = plot(upperBandValue3, title="Upper Band #3", color = color.teal, offset = offset, display = showBand_3 ? display.all : display.none, editable = showBand_3)
lowerBand_3 = plot(lowerBandValue3, title="Lower Band #3", color = color.teal, offset = offset, display = showBand_3 ? display.all : display.none, editable = showBand_3)
fill(upperBand_3, lowerBand_3, title="Bands Fill #3", color = color.new(color.teal, 95), display = showBand_3 ? display.all : display.none, editable = showBand_3)
===================
거듭 감사합니다. 수고하세요!!!
2025-05-14
323
글번호 190790
지표
답변완료
지표 문의 드립니다.
//@version=6
indicator(
title = "Stoch RSI + TEMA",
shorttitle = "SRTEMA",
overlay = false,
format = format.price,
precision = 2)
// ────────── 입력
smoothK = input.int(12 , "K" , minval = 1)
smoothD = input.int(3 , "D" , minval = 1)
rsiLen = input.int(14, "RSI Length" , minval = 1)
stochLen = input.int(14, "Stoch Len" , minval = 1)
src = input.source(close, "RSI Src")
temaLen = input.int(12 , "TEMA Length" , minval = 1)
// ────────── Stochastic RSI
rsiVal = ta.rsi(src, rsiLen)
k_raw = ta.stoch(rsiVal, rsiVal, rsiVal, stochLen)
k = ta.sma(k_raw, smoothK) // %K
d = ta.sma(k , smoothD) // %D
// ────────── TEMA (%K 기반)
ema1 = ta.ema(k, temaLen)
ema2 = ta.ema(ema1, temaLen)
ema3 = ta.ema(ema2, temaLen)
tema = 3 * (ema1 - ema2) + ema3
// ────────── 시각화
plot(k , "K" , color = color.blue , linewidth = 2)
plot(d , "D" , color = color.orange, linewidth = 2)
plot(tema, "TEMA", color = color.green , linewidth = 2)
hUpper = hline(80, "Upper" , color = color.gray)
hMid = hline(50, "Middle", color = color.new(color.gray, 50))
hLower = hline(20, "Lower" , color = color.gray)
fill(hUpper, hLower, color = color.rgb(33,150,243,90), title = "BG")
// ────────── 알림(선택)
bullCross = ta.crossover(k, tema)
bearCross = ta.crossunder(k, tema)
alertcondition(bullCross, "Bullish K>TEMA", "K crossed above TEMA")
alertcondition(bearCross, "Bearish K<TEMA", "K crossed below TEMA")
트레이딩뷰 수식인데 예스 수식으로 바꿔주세요.
2025-05-14
268
글번호 190789
지표
답변완료
지표 변환 문의드립니다. 질문 92667 관련
안녕하세요.건승을 기원합니다.
질문 92667 답변 관련 질문입니다.
3번 지표로 구현하엿는데,선은 필요없으니 신호만 나타낼수잇는 수식을 좀 알려주시면 감사하겟습니다.
상단,하단밴드는 버리고 중간선이 색갈이변할때만 신호를 표출하는 식을 부탁합니다.(색깔변하는 봉 바로 밑에 또는 위에)
제가 작성한 "잘못된" 수식입니다만
plot1(filt, "Filter", fcolor);
plot2(hband, "Filtered True Range High Band", fcolor);
plot3(lband, "Filtered True Range Low Band", fcolor);
if filt < filt[1] Then
{
tx = Text_New(sdate,sTime,H,"☎");
Text_SetStyle(tx,2,0);#좌우상하정렬
Text_SetColor(tx,Black);#색상
Text_SetSize(tx,20);#크기
}
if filt > filt[1] Then
{
tx = Text_New(sdate,sTime,L,"♥");
Text_SetStyle(tx,2,0);#좌우상하정렬
Text_SetColor(tx,Brown);#색상
Text_SetSize(tx,20);#크기
}
모든 봉 위 또는 아래에 신호가 나오네요. 이게 아니고 핵심은
색깔이 변할때만 나오게 해주면 됩니다.
감사합니다.(더불어 전략수식도 알려주시면 감사하겠숩니다)
2025-05-14
238
글번호 190788
지표