커뮤니티
문의 드립니다.
//============================================================================== // Inputs //==============================================================================
smoothingLength = input.int(5, "Price Smoothing Length", group = "SuperSmoother Settings") fastLength = input.int(20, "Fast MA", group = "Moving Average Settings") slowLength = input.int(50, "Slow MA", group = "Moving Average Settings") srcMA = input.source(close, "Source Data", group = "Moving Average Settings")
atrLength = input.int(20, "ATR Length", group = "Signal Generation") atrMultiplier = input.float(1.2, "ATR Multiplier", group = "Signal Generation") signalSensitivity = input.float(0.03, "Signal Sensitivity", minval=0.01, maxval=1.0, step=0.01, group = "Signal Generation")
showVortexFill = input.bool(true, "Show Vortex Fill", group = "Visualization") fillTransparency = input.int(85, "Fill Transparency", minval = 0, maxval = 100, group = "Visualization") enhancedColors = input.bool(true, "Enhanced Colors", group = "Visualization")
enableCandleColor = input.bool(true, "Enable Candle Coloring", group = "Candle Colors") //============================================================================== // SuperSmoother Function //==============================================================================
supersmoother(src, length) => a1 = math.exp(-1.414 * 3.14159 / length) b1 = 2.0 * a1 * math.cos(1.414 * 3.14159 / length) c2 = b1 c3 = -a1 * a1 c1 = 1 - c2 - c3 ss = 0.0 ss := c1 * (src + nz(src[1])) / 2 + c2 * nz(ss[1]) + c3 * nz(ss[2]) ss
//============================================================================== // Calculations //==============================================================================
smoothedPrice = supersmoother(srcMA, smoothingLength) fastMA = ta.ema(smoothedPrice, fastLength) slowMA = ta.ema(smoothedPrice, slowLength)
// True oscillator calculation - difference between MAs oscillator = fastMA - slowMA
// Normalize oscillator for better visualization oscillatorNormalized = oscillator / ta.atr(20) * 100
// Enhanced color system accel_raw = oscillator - oscillator[1] accel_smooth = ta.ema(accel_raw, 3)
tanh(x) => ex = math.exp(2 * x) (ex - 1) / (ex + 1)
accel_norm = tanh(accel_smooth / (ta.atr(20) * 0.01)) hue_raw = 60 + accel_norm * 60 hue = na(hue_raw[1]) ? hue_raw : (hue_raw + hue_raw[1]) / 2
hsv_to_rgb(h, s, v) => c = v * s x = c * (1 - math.abs((h / 60) % 2 - 1)) m = v - c r = 0.0, g = 0.0, b = 0.0 if h < 60 r := c, g := x, b := 0 else if h < 120 r := x, g := c, b := 0 else if h < 180 r := 0, g := c, b := x else if h < 240 r := 0, g := x, b := c else if h < 300 r := x, g := 0, b := c else r := c, g := 0, b := x color.rgb(int((r + m) * 255), int((g + m) * 255), int((b + m) * 255))
oscillatorColor = enhancedColors ? hsv_to_rgb(hue, 1.0, 1.0) : color.yellow
// Signal line (smoothed oscillator) signalLine = ta.ema(oscillator, 25)
//============================================================================== // Signal Generation - Focus on Oscillator-Signal Line Crossovers //==============================================================================
atr = ta.atr(atrLength) minSignalThreshold = atr * signalSensitivity
// Primary signals: Oscillator crossing above/below signal line bullishSignal = ta.crossover(oscillator, signalLine) and math.abs(oscillator - signalLine) > minSignalThreshold bearishSignal = ta.crossunder(oscillator, signalLine) and math.abs(oscillator - signalLine) > minSignalThreshold
// Additional confirmation: momentum direction oscillatorMomentum = oscillator - oscillator[1] signalMomentum = signalLine - signalLine[1]
// Enhanced signals with momentum confirmation strongBullishSignal = bullishSignal and oscillatorMomentum > 0 strongBearishSignal = bearishSignal and oscillatorMomentum < 0
//============================================================================== // Plots //==============================================================================
// Zero line reference zeroLine = hline(0, "Zero Line", color.gray, hline.style_dashed)
// Main oscillator oscillatorPlot = plot(oscillator, color = oscillatorColor, title = "Oscillator", linewidth = 2)
// Signal line signalColor = enhancedColors ? #FF6B35 : color.orange signalPlot = plot(signalLine, color = signalColor, title = "Signal Line", linewidth = 1)
// Histogram (optional visualization) histogramColor = oscillator > signalLine ? (enhancedColors ? #00FF7F : color.green) : (enhancedColors ? #FF1493 : color.red) plot(oscillator - signalLine, color = color.new(histogramColor, 70), style = plot.style_histogram, title = "Histogram")
// Zero line as plot for fill compatibility zeroLinePlot = plot(0, color = color.new(color.gray, 100), title = "Zero Line Plot")
// Oscillator fills oscillatorFillColor = showVortexFill ? (oscillator > 0 ? color.new(enhancedColors ? #00FF7F : color.green, fillTransparency) : color.new(enhancedColors ? #FF1493 : color.red, fillTransparency)) : na
fill(oscillatorPlot, zeroLinePlot, color = oscillatorFillColor, title = "Oscillator Fill")
// Signal crossover fill crossFillColor = showVortexFill ? (oscillator > signalLine ? color.new(color.blue, fillTransparency + 10) : color.new(color.purple, fillTransparency + 10)) : na
fill(oscillatorPlot, signalPlot, color = crossFillColor, title = "Signal Fill")
// Updated Signal Plots - Focus on Crossover Signals plotshape(bullishSignal, "Buy Signal", shape.triangleup, location.belowbar, color.green, 0, size = size.small, force_overlay = true) plotshape(bearishSignal, "Sell Signal", shape.triangledown, location.abovebar, color.red, 0, size = size.small, force_overlay = true)
// Strong signals with momentum confirmation plotshape(strongBullishSignal, "Strong Buy", shape.triangleup, location.belowbar, color.lime, 0, size = size.normal, force_overlay = true) plotshape(strongBearishSignal, "Strong Sell", shape.triangledown, location.abovebar, color.maroon, 0, size = size.normal, force_overlay = true)
// Signal line crossover areas for additional context bgcolor(bullishSignal ? color.new(color.green, 95) : na, title = "Bullish Signal BG") bgcolor(bearishSignal ? color.new(color.red, 95) : na, title = "Bearish Signal BG")
// Candle plot based on signal convergence and divergence // Determine candle color based on oscillator position relative to signal line candleColor = if not enableCandleColor na else if oscillator > signalLine color.green else if oscillator < signalLine color.red else color.gray
// Apply candle coloring barcolor(candleColor, title = "Candle Color")
위 수식에서 히스토그램은 빼고 두 라인선만 추출해서 예스 지표로 만들어주시고
그 두 선이 교차할때 매수/매도 신호가 나오는 시스템 수식도 하나 더 만들어주세요.
답변 1
예스스탁 예스스탁 답변
2025-12-01 14:08:47